Skip to content

Instantly share code, notes, and snippets.

@artheus
Last active October 26, 2017 13:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
My workspace bash function with completion
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