Skip to content

Commit fde8a13

Browse files
committed
Bash completions
1 parent 94a601e commit fde8a13

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

completions/sensor-data.bash

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@
33

44
_sensor_data() {
55
local cur prev words cword
6-
_init_completion || return
6+
7+
# Use _init_completion if available, otherwise fall back to manual setup
8+
if declare -F _init_completion >/dev/null 2>&1; then
9+
_init_completion || return
10+
else
11+
COMPREPLY=()
12+
cur="${COMP_WORDS[COMP_CWORD]}"
13+
prev="${COMP_WORDS[COMP_CWORD-1]}"
14+
words=("${COMP_WORDS[@]}")
15+
cword=$COMP_CWORD
16+
fi
717

818
local commands="transform list-errors summarise-errors stats"
919

@@ -42,7 +52,7 @@ _sensor_data() {
4252
case "$prev" in
4353
-o|--output)
4454
# Complete file names
45-
_filedir
55+
_filedir 2>/dev/null || COMPREPLY=($(compgen -f -- "$cur"))
4656
return
4757
;;
4858
-e|--extension)
@@ -95,8 +105,8 @@ _sensor_data() {
95105
esac
96106
else
97107
# Complete file/directory names
98-
_filedir
108+
_filedir 2>/dev/null || COMPREPLY=($(compgen -f -- "$cur"))
99109
fi
100110
}
101111

102-
complete -F _sensor_data sensor-data
112+
complete -o default -o bashdefault -F _sensor_data sensor-data

0 commit comments

Comments
 (0)