mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
fish(completion): support termux-sensor command
This commit is contained in:
parent
86e11ac844
commit
4235e212de
2 changed files with 67 additions and 0 deletions
61
share/completions/termux-sensor.fish
Normal file
61
share/completions/termux-sensor.fish
Normal file
|
@ -0,0 +1,61 @@
|
|||
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 [h]elp'
|
||||
|
||||
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 '[l]ist sensors'
|
||||
|
||||
complete -c $command \
|
||||
-a '(__fish_termux_api__complete_sensor_ids_as_list)' \
|
||||
-s s \
|
||||
-l sensors \
|
||||
-d 'Specify comma-separated [s]ensors to listen to' \
|
||||
-x
|
||||
|
||||
complete -c $command \
|
||||
-s d \
|
||||
-l delay \
|
||||
-d 'Specify an interval between sensor updates' \
|
||||
-x
|
||||
|
||||
complete -c $command \
|
||||
-a 'continuous\tdefault' \
|
||||
-s n \
|
||||
-l limit \
|
||||
-d 'Specify a number of times to read senors' \
|
||||
-x
|
|
@ -0,0 +1,6 @@
|
|||
function __fish_termux_api__complete_sensor_ids
|
||||
set -l command termux-sensor -l
|
||||
set ids ($command | jq --raw-output '.sensors[]')
|
||||
|
||||
string join \n -- $ids
|
||||
end
|
Loading…
Reference in a new issue