fish-shell/share/completions/termux-sensor.fish
2024-09-30 00:39:22 +10:00

61 lines
1.1 KiB
Fish

function __fish_termux_api__complete_sensor_ids_as_list
set ids (__fish_termux_api__complete_sensor_ids)
set token (commandline -t -c)
set delimiter ,
switch "$token"
case '*,'
set delimiter
end
test -z "$token" && set delimiter
for id in $ids
string unescape -- "$token$delimiter$id"
end
end
set command termux-sensor
complete -c $command -f
complete -c $command \
-s h \
-l help \
-d 'Show help'
complete -c $command \
-s a \
-l all \
-d 'Listen to all sensors'
complete -c $command \
-s c \
-l cleanup \
-d 'Release sensor resources'
complete -c $command \
-s l \
-l list \
-d 'List sensors'
complete -c $command \
-a '(__fish_termux_api__complete_sensor_ids_as_list)' \
-s s \
-l sensors \
-d 'Specify comma-separated sensors to listen to' \
-x
complete -c $command \
-s d \
-l delay \
-d 'Specify the delay between sensor updates' \
-x
complete -c $command \
-a 'continuous\tdefault' \
-s n \
-l limit \
-d 'Specify a number of times to read senors' \
-x