Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Add bash completion config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Larionov committed Jun 30, 2013
1 parent 74872a9 commit 380f6ff
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions split2flac-bash-completion.sh
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

_split2flac () {
local cur prev opts formats

_get_comp_words_by_ref cur prev

opts="-p -o -of -cue -cuecharset -nask -f -e -eh -enca -c -nc -C -nC -cs -d -nd -D -nD -F -colors -nocolors -g -ng -s -h -v"
formats="flac m4a mp3 ogg wav"

if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
else
case "${prev}" in
-o)
_filedir -d
;;
-of|-e|-enca|-C|-cs)
# no completion, wait for user input
;;
-cue)
_filedir cue
;;
-cuecharset)
local available_locales
available_locales=$( iconv -l | sed 's,//,,g' )
COMPREPLY=( $(compgen -W "${available_locales}" -- ${cur}) )
;;
-c)
_filedir
;;
-f)
COMPREPLY=( $(compgen -W "${formats}" -- ${cur}) )
;;
*)
_filedir
;;
esac
fi
}

complete -F _split2flac split2flac

0 comments on commit 380f6ff

Please sign in to comment.