Improve zsh autocompletion
Main changes: - Allow grouping single-letter options (current single letter options are exclusive, but that might change in the future. Qt supports parsing such groups) - Allowing completions like "-d<id>" and "--device=<id>" - Make operations exclusive in completion (e.g. --ping and --ring can't be used at the same time)
This commit is contained in:
parent
fb174b23e3
commit
f73ee46fca
1 changed files with 33 additions and 27 deletions
|
@ -4,31 +4,37 @@ _kdeconnect_device-ids() {
|
||||||
_values "KDE Connect device id" "${(f)$(kdeconnect-cli --shell-device-autocompletion=zsh 2>/dev/null)}"
|
_values "KDE Connect device id" "${(f)$(kdeconnect-cli --shell-device-autocompletion=zsh 2>/dev/null)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_arguments \
|
#See http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-_005farguments for autocomplete documentation
|
||||||
'(-l --list-devices -a --list-available)'{-l,--list-devices}'[list all devices]' \
|
#
|
||||||
'(-l --list-devices -a --list-available)'{-a,--list-available}'[list available (paired and reachable) devices]' \
|
#The --desktopfile option is not included, since it rarely makes sense to use
|
||||||
'--id-only[make --list-devices or --list-available print only the devices id, to ease scripting]' \
|
#The --shell-device-autocompletion option is not included, since it's not even in the help (and only required for scripts like these)
|
||||||
'--refresh[search for devices in the network and re-establish connections]' \
|
local blockoperations="(operation sms)"
|
||||||
'(--pair --unpair)--pair[request pairing with the specified device]' \
|
_arguments -s \
|
||||||
'--ring[find the device by ringing it.]' \
|
|
||||||
'(--pair --unpair)--unpair[stop pairing to the specified device]' \
|
|
||||||
'(--ping --ping-msg)--ping[send a ping to the device]' \
|
|
||||||
'(--ping --ping-msg)--ping-msg[send a ping to the device with the specified message]:message' \
|
|
||||||
'--share[share a file to the device]:file:_files' \
|
|
||||||
'--list-notifications[display the notifications on the device]' \
|
|
||||||
'--lock[lock the specified device]' \
|
|
||||||
'--send-sms[send an SMS. Requires --destination]:message' \
|
|
||||||
'--destination[specify phone number to send the SMS to]:phone number' \
|
|
||||||
'(-d --device -n --name)'{-d,--device}'[specify device ID]:id:_kdeconnect_device-ids' \
|
|
||||||
'(-d --device -n --name)'{-n,--name}'[specify device name]:name' \
|
|
||||||
'--encryption-info[get encryption info about the device]' \
|
|
||||||
'--list-commands[list remote commands and their ids]' \
|
|
||||||
'--execute-command[execute a remote command]:command id' \
|
|
||||||
'(-k --send-keys)'{-k,--send-keys}'[send keys to the specified device]' \
|
|
||||||
"--my-id[display this device's id]" \
|
|
||||||
"--photo[open the connected device's camera and transfer the photo]:file:_files" \
|
|
||||||
'(-)'{-h,--help}'[display usage information]' \
|
'(-)'{-h,--help}'[display usage information]' \
|
||||||
'(-)'{-v,--version}'[display version information]' \
|
+ '(global)' \
|
||||||
'(-)--author[show author information and exit]' \
|
$blockoperations{-l,--list-devices}'[list all devices]' \
|
||||||
'(-)--license[show license information and exit]' \
|
$blockoperations{-a,--list-available}'[list available (paired and reachable) devices]' \
|
||||||
'--desktopfile[specify base file name of the desktop entry for this application]:file'
|
$blockoperations'--refresh[search for devices in the network and re-establish connections]' \
|
||||||
|
{-d=,--device=}'[specify device ID]:id:_kdeconnect_device-ids' \
|
||||||
|
{-n=,--name=}'[specify device name]:name' \
|
||||||
|
$blockoperations''{-v,--version}'[display version information]' \
|
||||||
|
$blockoperations'--author[show author information and exit]' \
|
||||||
|
$blockoperations'--license[show license information and exit]' \
|
||||||
|
$blockoperations"--my-id[display this device's id]" \
|
||||||
|
+ '(operation)' \
|
||||||
|
$blockoperations'--pair[request pairing with the specified device]' \
|
||||||
|
$blockoperations'--ring[find the device by ringing it.]' \
|
||||||
|
$blockoperations'--unpair[stop pairing to the specified device]' \
|
||||||
|
$blockoperations'--ping[send a ping to the device]' \
|
||||||
|
$blockoperations'--ping-msg=[send a ping to the device with the specified message]:message' \
|
||||||
|
$blockoperations'--share=[share a file to the device]:file:_files' \
|
||||||
|
$blockoperations'--list-notifications[display the notifications on the device]' \
|
||||||
|
$blockoperations'--lock[lock the specified device]' \
|
||||||
|
$blockoperations'--encryption-info[get encryption info about the device]' \
|
||||||
|
$blockoperations'--list-commands[list remote commands and their ids]' \
|
||||||
|
$blockoperations'--execute-command=[execute a remote command]:command id' \
|
||||||
|
$blockoperations{-k=,--send-keys=}'[send keyboard input to the specified device]:keyboard input' \
|
||||||
|
$blockoperations"--photo=[open the connected device's camera and transfer the photo]:file:_files" \
|
||||||
|
+ 'sms' \
|
||||||
|
'(operation)--send-sms=[send an SMS]:message:' \
|
||||||
|
'(operation)--destination=[specify phone number to send the SMS to]:phone number:'
|
||||||
|
|
Loading…
Reference in a new issue