mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 04:20:04 +01:00
add completions for CLI
This commit is contained in:
parent
faa6d8a6b3
commit
422ac4be74
4 changed files with 38 additions and 0 deletions
21
data/zsh-completion/_upower
Normal file
21
data/zsh-completion/_upower
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#compdef upower
|
||||||
|
_enumerate_objects() {
|
||||||
|
local expl
|
||||||
|
local -a objects
|
||||||
|
objects=( ${(f)"$(
|
||||||
|
_call_program upower-enumerate-objects \
|
||||||
|
upower -e
|
||||||
|
)"} )
|
||||||
|
_wanted objects expl "object path" \
|
||||||
|
compadd -a objects -d objects
|
||||||
|
}
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
"(--enumerate -e)"{--enumerate,-e}"[Enumerate objects paths for devices]" \
|
||||||
|
"(--dump -d)"{--dump,-d}"[Dump all parameters for all objects]" \
|
||||||
|
"(--monitor -m)"{--monitor,-m}"[Monitor activity from the power daemon]" \
|
||||||
|
"--monitor-detail""[Monitor with detail]" \
|
||||||
|
"(--show-info -i)"{--show-info,-i}"[Show information about object path]"":::_enumerate_objects" \
|
||||||
|
"(--version -v)"{--version,-v}"[Print version of client and daemon"] \
|
||||||
|
|
||||||
|
compdef _upower upower
|
||||||
12
data/zsh-completion/meson.build
Normal file
12
data/zsh-completion/meson.build
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
zshcompletiondir = get_option('zshcompletiondir')
|
||||||
|
if zshcompletiondir == ''
|
||||||
|
zshcompletiondir = get_option('datadir') / 'zsh' / 'site-functions'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if zshcompletiondir != 'no'
|
||||||
|
install_data(
|
||||||
|
'_upower',
|
||||||
|
install_dir: zshcompletiondir,
|
||||||
|
install_mode: 'rw-r--r--',
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
@ -138,6 +138,7 @@ subdir('libupower-glib')
|
||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('tools')
|
subdir('tools')
|
||||||
subdir('doc')
|
subdir('doc')
|
||||||
|
subdir('data/zsh-completion')
|
||||||
subdir('policy')
|
subdir('policy')
|
||||||
|
|
||||||
pkgconfig = import('pkgconfig')
|
pkgconfig = import('pkgconfig')
|
||||||
|
|
|
||||||
|
|
@ -40,3 +40,7 @@ option('polkit',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
value: 'auto',
|
value: 'auto',
|
||||||
description: 'PolKit support in daemon')
|
description: 'PolKit support in daemon')
|
||||||
|
option('zshcompletiondir',
|
||||||
|
type: 'string',
|
||||||
|
value: '',
|
||||||
|
description: 'Directory for zsh completion scripts ["no" disables]')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue