Last active
October 26, 2017 13:44
-
-
Save artheus/85e149db1633b2c3f03e845772ab77fc to your computer and use it in GitHub Desktop.
My workspace bash function with completion
This file contains hidden or 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
function wp() { | |
cd "$HOME/workspace/$1" | |
} | |
__wp_path_comp() | |
{ | |
local cur_word="${COMP_WORDS[COMP_CWORD]}" | |
local wpcontent | |
wpcontent=`find $HOME/workspace/${cur_word}* -maxdepth 0 -type d -print 2> /dev/null | sed -e "s|$HOME/workspace/||" ` | |
COMPREPLY=( $(compgen -W "$wpcontent" -S "/" -- $2) ) | |
} | |
complete -o nospace -F __wp_path_comp wp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment