This repository has been archived by the owner on May 9, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anton Larionov
committed
Jun 30, 2013
1 parent
74872a9
commit 380f6ff
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |