Skip to content

Instantly share code, notes, and snippets.

Last active Oct 26, 2017
What would you like to do?
My workspace bash function with completion
function wp() {
cd "$HOME/workspace/$1"
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