Skip to content

Commit

Permalink
feat(bash and zsh autocompletion for tunasynctl):
Browse files Browse the repository at this point in the history
  • Loading branch information
bigeagle committed Aug 2, 2016
1 parent ca80dff commit 83fc766
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions autocomplete/tunasynctl.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/bash

: ${PROG:=$(basename ${BASH_SOURCE})}

_cli_bash_autocomplete() {
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}

complete -F _cli_bash_autocomplete $PROG
15 changes: 15 additions & 0 deletions autocomplete/tunasynctl.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
autoload -U compinit && compinit
autoload -U bashcompinit && bashcompinit

: ${PROG:=$(basename ${BASH_SOURCE})}

_cli_bash_autocomplete() {
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}

complete -F _cli_bash_autocomplete $PROG

0 comments on commit 83fc766

Please sign in to comment.