Created
June 10, 2018 15:20
-
-
Save chrisgfortes/477a601be52c386ccc195c2812c595ed to your computer and use it in GitHub Desktop.
Using custom command in the bash with autocompletion (MacOS - Bash)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
source ~/.bash_functions; | |
alias project='project $1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_project_complete(){ | |
COMPREPLY=($(compgen -d "$HOME"/Documents/Projects/"$2")) | |
COMPREPLY=("${COMPREPLY[@]##*/}") | |
} | |
project(){ | |
cd $HOME/Documents/Projects/$1 | |
} | |
complete -F _project_complete project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
source ~/.aliases; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment