Skip to content

Commit

Permalink
Merge pull request #39 from ericem/bash-completion
Browse files Browse the repository at this point in the history
Add BASH completion
  • Loading branch information
jamesob committed Nov 18, 2015
2 parents 0726292 + bccb009 commit 3c500b4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions completions/bash/desk
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#Bash completion for ◲ desk

_desk() {
PREFIX="${DESK_DIR:-$HOME/.desk}"
DESKS="${DESK_DESKS_DIR:-$PREFIX/desks}"

cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}

case ${COMP_CWORD} in
1)
COMPREPLY=($(compgen -W "edit . go help init list ls version" ${cur}))
;;
2)
case ${prev} in
edit|go|.)
if [[ -d $DESKS ]]; then
local desks=$(ls $DESKS/ | cut -d'.' -f1)
else
local desks=""
fi
COMPREPLY=( $(compgen -W "${desks}" -- ${cur}) )
;;
esac
;;
*)
COMPREPLY=()
;;
esac
}


complete -F _desk desk
File renamed without changes.

0 comments on commit 3c500b4

Please sign in to comment.