So I have downloaded the git-completion.bash from here as you can see from the following output:
$ ls ~ | grep git-completion
-rw-r--r-- 1 waldyr staff 64720 Jul 21 23:43 .git-completion.bash
I'm running macOS High Sierra version 10.13.6 and I downloaded bash-completion using homebrew as you can see from the following output:
$ brew info bash-completion
bash-completion: stable 1.3 (bottled)
Programmable completion for Bash 3.2
https://salsa.debian.org/debian/bash-completion
Conflicts with:
bash-completion#2 (because Differing version of same formula)
/usr/local/Cellar/bash-completion/1.3_3 (189 files, 608.2KB) *
Poured from bottle on 2018-07-18 at 11:25:01
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/bash-completion.rb
==> Caveats
Add the following line to your ~/.bash_profile:
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
My .bash_profile sources a file called .bashrc which sources both bash-completion and git completion with telling the :
$ cat ~/.bash_profile
. ~/.bashrc
$ cat ~/.bashrc
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
__git_complete gp _git_push
fi
alias gp='git push'
Whenever I type gp in the terminal and press tab asking for completion the script works perfectly:
$ gp <tab>
origin production
And after my selection of a repository the completion doesn't work for the refspec:
When there's nothing after it keeps showing the repositories:
$ gp origin <tab>
origin production
If there's at least one letter it (for example m from master), it looks for the files in the current directory
$ gp origin m<tab>
Makefile Minafile
I know I can alias git in the bashrc to g and alias git-push in gitconfig to p making the command g p which the completion works perfectly but I find annoying having to type the space.
What am I missing to make the completion work for the second argument (refspec)? Is that a git bug?
Here is the link for my dotfiles so you can check the whole files.
Related
I am running fishshell 3.5.1 on MacOS Monterey 12.5.1
I can work most all commands just fine but whenever I try to type in the dollar sign (even before pressing Return) I get the error: "Unknown command: bind_dollar"
I've tried:
Reinstalling w/Homebrew
Confirming that fish is in PATH
Deleting my fish.config
Below is the output of my issue and setup:
This happens as soon as I type a dollar sign:
$ fish: Unknown command: bind_dollar
Fish config directory:
~/.config/fish
$ ls
completions/ conf.d/ config.fish fish_variables functions/
Using /bin/sh to examine my $PATH:
$ /bin/sh
sh-3.2$ echo $PATH
/usr/local/bin:/usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
Ensuring fish is located in PATH:
sh-3.2$ whereis fish
fish: /usr/local/bin/fish
Viewing the contents of my fish.config (which is the default version):
sh-3.2$ cat config.fish
if status is-interactive
# Commands to run in interactive sessions can go here
end
Thanks to Glenn's comment, I was able to track down the issue:
Running:
grep -r bind_dollar ~/.config/fish
Returned:
~/.config/fish/functions/fish_user_key_bindings.fish
Which contained:
function fish_user_key_bindings
### bang-bang ###
bind ! bind_bang
bind $ bind_dollar # <-- removing this line fixed the issue
### bang-bang ###
end
Removing the "bind_dollar" line fixed the issue.
I want to execute command gclient. I have already included its location in PATH. But I cannot directly execute it by command. Can someone tell me why?
~
❯ echo $PATH
/User/merle/depot_tools:/Users/merle/.nvm/versions/node/v11.10.0/bin:/usr/local/opt/mysql#5.5/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
~
❯ ls depot_tools | grep gclient
README.gclient.md
annotated_gclient.py
gclient
gclient-new-workdir.py
gclient.bat
gclient.py
gclient_completion.sh
gclient_eval.py
gclient_paths.py
gclient_scm.py
gclient_utils.py
~
❯ gclient
zsh: command not found: gclient
~
❯ cd depot_tools
~/depot_tools master
❯ ./gclient
Usage: gclient.py <command> [options]
Meta checkout dependency manager for Git.
Commands are:.......
Take another look at your path:
export PATH=/User/merle/depot_tools:/Users/merle/...
Does your system contain just 1 User or multiple Users???
It should read:
export PATH=/Users/merle/depot_tools:/Users/merle/...
i think you may forget
source ~/.nvm/nvm.sh
if you want automatically load it ,there are two ways
open ~/.zshrc
1.add
source ~/.nvm/nvm.sh
2.or add
export NVM_DIR="/Users/YOUR_USER_NAME(you need use you user name)/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
hope this can help you
ZSH: command not found
The Problem was .zshrc, it was missing.
the solution which worked for me :
You have to create a .zshrc file.
to create use "vim .zshrc" command then insurt your path "export PATH="$PATH:pwd/flutter/bin"
save and completely exit your terminal completely. install gem cocoa pods then accept the license. you are good to go.
i am trying to install go from source
i follow this steps
git clone https://go.googlesource.com/go
cd go
git checkout go1.6.1
cd src
./all.bash
now it gives me the error saying
##### Building Go bootstrap tool.
cmd/dist
ERROR: Cannot find /root/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
any idea how can i fix this do i just need to set env variable or any other installation is needed ?
You need to have an installed Go version 1.4 or newer to build the recent Go releases. The build script defaults to some path but if it's not there you need to set GOROOT_BOOTSTRAP environment variable to point to a previous working Go installation.
Go is written in Go (starting from version 1.5) so you have to install Go1.4 first. Just get Go Version Manager and run:
$ gvm install go1.4
$ gvm use go1.4
$ export GOROOT_BOOTSTRAP=$GOROOT
Another approach is about to install gcc go frontend:
$ sudo apt-get install gccgo-5
$ sudo update-alternatives --set go /usr/bin/go-5
$ export GOROOT_BOOTSTRAP=/usr
If you are not using gvm and are on Linux, your go binary is mostly installed at /usr/local/go/bin/go. You need to set /usr/local/go as your GOROOT_BOOTSTRAP by:
$ export GOROOT_BOOTSTRAP=/usr/local/go
The following won't work if you haven't previously built from source (the version parsing will fail). Unfortunately it also won't work for windows (unless you're in wsl/cygwin/msys et cetera).
If you have the source for an older version you may want to use the following zsh/bash(?) function
# create a backup of a directory by recursively copying its contents into an empty one with a similar name
bckp () {
old=$1
if [[ -z $1 ]]; then
old="../$(basename "$(pwd)")"
fi
new="$old-bckp"
[[ -d $new ]] && echo "already exists" && return 1
cp -rf "$old/" "$new"
}
then do one, or some combination, of the following
if you have unstashed changes you want to commit:
cd $(go env GOROOT) # visit the root directory of your current go installation
bckp # back it up
git stash # keep any changes you've made but do not want to commit in a safe place
git pull # collect remote commits
git stash pop # restore your changes
cd src # go to the golang source files and installation scripts
export GOROOT_BOOTSTRAP=$(go env GOROOT)-bckp # make the environment variable accessible from other shells
chmod +x ./all.bash # set the permissions of the installation/build script so that it can be executed
./all.bash # execute the installation/build script
cd ../bin && sudo ln -f $PWD/go /usr/bin/go # create a globablly accessible link to the new binary, feels like it should be unnecessary but I couldn't use the new binary until I did this
or, if you've already pulled the commits you wish to include and popped your changes:
cd $(go env GOROOT) # visit the root directory of your current go installation
bckp # back it up
cd ../go-bckp # enter the backup directory
git stash # keep any changes you've made but do not want to commit in a safe place
git checkout $(go version | cut -d- -f2 | cut -d" " -f1) # parse version info and restore the old codebase
git stash pop # restore your changes
cd ../go/src # go to the golang source files and installation scripts
export GOROOT_BOOTSTRAP=$(go env GOROOT)-bckp # make the environment variable accessible from other shells
chmod +x ./all.bash # set the permissions of the installation/build script so that it can be executed
./all.bash # execute the installation/build script
cd ../bin && sudo ln -f $PWD/go /usr/bin/go # create a globablly accessible link to the new binary, feels like it should be unnecessary but I couldn't use the new binary until I did this
or if you haven't made any changes:
cd $(go env GOROOT) # visit the root directory of your current go installation
bckp # back it up
cd src # go to the golang source files and installation scripts
export GOROOT_BOOTSTRAP=$(go env GOROOT)-bckp # make the environment variable accessible from other shells
chmod +x ./all.bash # set the permissions of the installation/build script so that it can be executed
./all.bash # execute the installation/build script
cd ../bin && sudo ln -f $PWD/go /usr/bin/go # create a globablly accessible link to the new binary, feels like it should be unnecessary but I couldn't use the new binary until I did this.
I am using Arch Linux with MATE as desktop environment. So terminal emulator is MATE Terminal. Recently I installed Jekyll with gem install jekyll. But when I ran jekyll -v it says bash: jekyll: command not found. So I tried to add path of Jekyll to PATH variable.
I ran PATH=$PATH/$HOME/.gem/ruby/2.2.0/bin and it worked perfectly. Now I can run jekyll commands. To add it permanently to PATH variable I edited the ~/.bash_profile file like following. It is not working after reboot. But
source ~/.bash_profile works perfectly.
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
export PATH="${PATH}:/home/heisenberg/.gem/ruby/2.2.0/bin"
According to ArchWiki this is the proper way to concat something permanantly to PATH. But it isn't working. Can somebody figure me out where the wrong is?
[N. B. : Adding the same line in ~/.bashrc is doing okay.]
Depending on the option it is given, bash can be run as an interactive shell or login shell. The default interactive shell mode does not read ~/.bash_profile. login shell bash do.
See:
First, some setup:
% cat ~/.bashrc
…
export BASHRC="yes"
…
% cat ~/.bash_profile
…
export BASH_PROFILE="yes"
…
Now run a regular (interactive) bash:
% bash
[galaux#magenta ~]$ echo $BASHRC
yes
[galaux#magenta ~]$ echo $BASH_PROFILE
Notice we did not get yes with this last one.
Now with a login shell:
% bash --login
[galaux#magenta ~]$ echo $BASHRC
yes
[galaux#magenta ~]$ echo $BASH_PROFILE
yes
See paragraph INVOCATION from man bash.
I'm attempting to install https://github.com/jehiah/json2csv. The problem is apparently tied to my noob status w.r.t. Bash.
System: Ubuntu 14.04 LTS
Load instruction:
$ go get github.com/jehiah/json2csv
Go is installed:
$ which go ==> /usr/bin/go
~/.bashrc setup:
export GOROOT=/usr/bin/go
export GOPATH=$HOME/projects/go
The package seems to download correctly:
$ cd projects/go
$ tree
$ > bin > json2csv
> src > github.com
...
$ ls bin -l
$ > -rwxrwxr-x 1 <user> <user> 55400 Feb 5 13:57 json2csv
But $json2csv isn't recognized, even from the same directory. I'm sure this is a noob problem, but I haven't cracked it yet. Suggestions?
Add $GOPATH/bin to your PATH variable in your shell,
for bash:
export PATH=$GOPATH/bin:$PATH