summaryrefslogtreecommitdiffstats
path: root/shell-completion
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:20:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:20:20 +0000
commit8612d3d858fa108e5732a586d4e2d0227ae34422 (patch)
tree33e7f8b3d5caa6c44b4d6759cb25d3eff4b2d975 /shell-completion
parentAdding debian version 256.2-1. (diff)
downloadsystemd-8612d3d858fa108e5732a586d4e2d0227ae34422.tar.xz
systemd-8612d3d858fa108e5732a586d4e2d0227ae34422.zip
Merging upstream version 256.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'shell-completion')
-rw-r--r--shell-completion/zsh/_networkctl2
-rw-r--r--shell-completion/zsh/_varlinkctl52
-rw-r--r--shell-completion/zsh/meson.build1
3 files changed, 54 insertions, 1 deletions
diff --git a/shell-completion/zsh/_networkctl b/shell-completion/zsh/_networkctl
index 6969797..ad5b91f 100644
--- a/shell-completion/zsh/_networkctl
+++ b/shell-completion/zsh/_networkctl
@@ -29,7 +29,7 @@
(list|status|up|down|cat|edit|lldp|delete|renew|forcerenew|reconfigure)
for link in ${(f)"$(_call_program links networkctl list --no-legend)"}; do _links+=($link[(w)2]:$link); done
if [[ -n "$_links" ]]; then
- _describe -t links 'links' _links _links $( [[ $cmd == (edit|cat) ]] && print -- -P@ )
+ _describe -t links 'links' _links $( [[ $cmd == (edit|cat) ]] && print -- -P@ )
else
_message "no links"
fi
diff --git a/shell-completion/zsh/_varlinkctl b/shell-completion/zsh/_varlinkctl
new file mode 100644
index 0000000..720700d
--- /dev/null
+++ b/shell-completion/zsh/_varlinkctl
@@ -0,0 +1,52 @@
+#compdef varlinkctl
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+local -a reply line
+
+_varlinkctl_interfaces() {
+ local expl
+ _wanted varlink-interfaces expl interface compadd "$@" -- \
+ "${(@f)$(_call_program varlink-interfaces varlinkctl list-interfaces $line[2])}"
+}
+
+_varlinkctl_methods() {
+ local expl
+ _wanted varlink-interfaces expl method compadd "$@" -- \
+ "${(@f)$(_call_program varlink-methods varlinkctl list-methods $line[2])}"
+}
+
+local -a varlink_addr=(
+ /$'[^\0]#\0'/ ':varlink-address:varlink address:_files -g "*(=)"'
+)
+local -a varlink_interface=(
+ $varlink_addr
+ /$'[^\0]#\0'/ ':varlink-interface:varlink interface:_varlinkctl_interfaces'
+)
+local -a varlink_method=(
+ $varlink_addr
+ /$'[^\0]#\0'/ ':varlink-method:varlink method:_varlinkctl_methods'
+)
+local -a varlink_call=($varlink_method /$'[^\0]#\0'/ ':argument:argument:()')
+local -a varlink_idl=(/$'[^\0]#\0'/ ':varlink-idl-file:idl file:_files')
+
+_regex_words varlink-commands 'varlink command' \
+ 'info:show service information:$varlink_addr' \
+ 'list-interfaces:List interfaces implemented by a service:$varlink_addr' \
+ 'list-methods:List methods implemented by an interface:$varlink_interface' \
+ 'introspect:show an interface definition:$varlink_interface' \
+ 'call:invoke a method:$varlink_call' \
+ 'validate-idl:validate an interface description:$varlink_idl' \
+ 'help:show a help message'
+
+local -a varlinkcmd=( /$'[^\0]#\0'/ "$reply[@]" )
+_regex_arguments _varlinkctl_command "$varlinkcmd[@]"
+
+local -a opts=(
+ {-h,--help}'[Show a help message and exit]'
+ '--version[Show package version and exit]'
+ '--no-pager[Do not pipe output to a pager]'
+ '--more[Request multiple responses]'
+ '--collect[Collect multiple responses in a JSON array]'
+ {-j+,--json=}'[Output as json]:json-mode:(pretty short)'
+)
+_arguments -S $opts '*:: := _varlinkctl_command'
diff --git a/shell-completion/zsh/meson.build b/shell-completion/zsh/meson.build
index acbf34e..ea540c7 100644
--- a/shell-completion/zsh/meson.build
+++ b/shell-completion/zsh/meson.build
@@ -23,6 +23,7 @@ items = [['_busctl', ''],
['_systemd-run', ''],
['_run0', ''],
['_udevadm', ''],
+ ['_varlinkctl', ''],
['_kernel-install', 'ENABLE_KERNEL_INSTALL'],
['_sd_hosts_or_user_at_host', ''],
['_sd_outputmodes', ''],