Skip to content

Instantly share code, notes, and snippets.

@fk128
Created December 1, 2017 13:59
Show Gist options
  • Save fk128/6ca62ac3580cefc52d25d13d57683d13 to your computer and use it in GitHub Desktop.
Save fk128/6ca62ac3580cefc52d25d13d57683d13 to your computer and use it in GitHub Desktop.
jrnl bash completion for listing journals
# place file in /etc/bash_completion.d/
_jrnl()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="`jrnl -ls`"
if [ "$COMP_CWORD" -eq 1 ]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
fi
return 0
}
complete -F _jrnl jrnl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment