-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvmgr-completion.bash
More file actions
117 lines (104 loc) · 3.39 KB
/
Copy pathvmgr-completion.bash
File metadata and controls
117 lines (104 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# Bash completion for Video Manager Ultimate
# Source this file or copy to /etc/bash_completion.d/
_vmgr_completion() {
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# Main commands
local commands="rename flatten cleanup duplicates subtitles workflow-new workflow-clean batch"
# Special commands (prefixed with --)
local special_commands="--organize --undo-organize --list-undo"
# Options
local options="
--help -h
--version -v
--dry-run -d
--quiet -q
--interactive -i
--model
--format
--language
--gpu
--parallel
--no-optimize
--edit
--speaker-diarization
--no-punctuation
--organize
--organize-target
--organize-search
--undo-organize
--list-undo
"
# Whisper models
local models="tiny base small medium large"
# Subtitle formats
local formats="srt vtt txt json"
# Language codes (common ones)
local languages="auto en es fr de it pt ru ja zh ko ar"
case "${prev}" in
--model)
COMPREPLY=( $(compgen -W "${models}" -- ${cur}) )
return 0
;;
--format)
COMPREPLY=( $(compgen -W "${formats}" -- ${cur}) )
return 0
;;
--language)
COMPREPLY=( $(compgen -W "${languages}" -- ${cur}) )
return 0
;;
--parallel)
COMPREPLY=( $(compgen -W "1 2 3 4 5 6 7 8" -- ${cur}) )
return 0
;;
--organize-target|--organize-search)
# After organize options, complete directories
COMPREPLY=( $(compgen -d -- ${cur}) )
return 0
;;
vmgr|video-manager-ultimate.sh|./video-manager-ultimate.sh)
# First argument - offer commands and options
COMPREPLY=( $(compgen -W "${commands} ${options}" -- ${cur}) )
return 0
;;
rename|flatten|cleanup|duplicates|subtitles|workflow-new|workflow-clean)
# After a command, offer directory completion
COMPREPLY=( $(compgen -d -- ${cur}) )
return 0
;;
esac
# If current word starts with -, complete options
if [[ ${cur} == -* ]]; then
COMPREPLY=( $(compgen -W "${options}" -- ${cur}) )
return 0
fi
# Check if we already have a command
local has_command=0
for word in "${COMP_WORDS[@]}"; do
if [[ " ${commands} " =~ " ${word} " ]] || [[ " ${special_commands} " =~ " ${word} " ]]; then
has_command=1
break
fi
done
if [[ ${has_command} -eq 1 ]]; then
# We have a command, complete with directories (except for special commands that don't need directories)
if [[ " ${special_commands} " =~ " ${prev} " ]] && [[ "${prev}" == "--list-undo" ]]; then
# --list-undo doesn't take arguments
COMPREPLY=()
else
COMPREPLY=( $(compgen -d -- ${cur}) )
fi
else
# No command yet, offer commands and options
COMPREPLY=( $(compgen -W "${commands} ${options}" -- ${cur}) )
fi
return 0
}
# Register completion
complete -F _vmgr_completion vmgr
complete -F _vmgr_completion video-manager-ultimate.sh
complete -F _vmgr_completion ./video-manager-ultimate.sh