- Migrate album_metadata_save, album_rename & album_renum,
- Add album_metadata_save, album_rename & album_renum completion scripts.
This commit is contained in:
@@ -25,25 +25,67 @@
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Album Convert Completion
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
_album_convert_completion()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="-h --help -V --version -T --test -v --verbose -r --resample -d --downsampled_tag"
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
local opts="-h --help -V --version -T --test -v --verbose -r --resample -d --downsampled_tag"
|
||||
|
||||
if [[ ${cur} == -* ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
local pos=0
|
||||
local i
|
||||
|
||||
COMPREPLY=()
|
||||
|
||||
# Complete options if current word starts with '-'
|
||||
if [[ "${cur}" == -* ]]
|
||||
then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Handle directory completion for source_dir and target_dir
|
||||
if [[ ${COMP_CWORD} -eq 1 ]] || [[ ${prev} != -* && ${COMP_CWORD} -eq 2 ]]; then
|
||||
COMPREPLY=( $(compgen -d -- "${cur}") )
|
||||
fi
|
||||
# Count non-option positional arguments already provided
|
||||
for (( i=1; i<COMP_CWORD; i++ ))
|
||||
do
|
||||
case "${COMP_WORDS[i]}" in
|
||||
-T|--test|-h|--help|-V|--version|-v|--verbose|-r|--resample|-d|--downsampled_tag)
|
||||
;;
|
||||
|
||||
--)
|
||||
;;
|
||||
|
||||
-*)
|
||||
;;
|
||||
|
||||
*)
|
||||
pos=$(( pos + 1 ))
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Complete positional arguments
|
||||
case "${pos}" in
|
||||
0)
|
||||
# source_dir: directory completion
|
||||
COMPREPLY=( $(compgen -d -- "${cur}") )
|
||||
;;
|
||||
|
||||
1)
|
||||
# target_dir: directory completion
|
||||
COMPREPLY=( $(compgen -d -- "${cur}") )
|
||||
;;
|
||||
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
complete -F _album_convert_completion album_convert
|
||||
complete -o filenames -F _album_convert_completion album_convert
|
||||
|
||||
Reference in New Issue
Block a user