Skip to content

Instantly share code, notes, and snippets.

@jeremyf
Created September 22, 2012 22:27
Show Gist options
  • Save jeremyf/3768044 to your computer and use it in GitHub Desktop.
Save jeremyf/3768044 to your computer and use it in GitHub Desktop.
bash-completion
# project completion for Sublime projects by Jeremy Friesen <jeremy.n.friesen@gmail.com>
function _project {
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
COMPREPLY=( $(find $HOME/Repositories -type d -maxdepth 1 -mindepth 1 -exec basename {} \; | egrep "^$cur"))
}
complete -F _project -o default project
# Assumes that $HOME/Repositories houses all of your project repositories.
# Assumes `project` accepts one for a directory that is in the
# $HOME/Repositories directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment