summaryrefslogtreecommitdiffstats
path: root/shell-completion/zsh/_systemd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:00:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:00:47 +0000
commit2cb7e0aaedad73b076ea18c6900b0e86c5760d79 (patch)
treeda68ca54bb79f4080079bf0828acda937593a4e1 /shell-completion/zsh/_systemd
parentInitial commit. (diff)
downloadsystemd-upstream.tar.xz
systemd-upstream.zip
Adding upstream version 247.3.upstream/247.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--shell-completion/zsh/_systemd81
-rw-r--r--shell-completion/zsh/_systemd-analyze99
-rw-r--r--shell-completion/zsh/_systemd-delta17
-rw-r--r--shell-completion/zsh/_systemd-inhibit36
-rw-r--r--shell-completion/zsh/_systemd-nspawn52
-rw-r--r--shell-completion/zsh/_systemd-path8
-rw-r--r--shell-completion/zsh/_systemd-run65
-rw-r--r--shell-completion/zsh/_systemd-tmpfiles14
8 files changed, 372 insertions, 0 deletions
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
new file mode 100644
index 0000000..5a8af1c
--- /dev/null
+++ b/shell-completion/zsh/_systemd
@@ -0,0 +1,81 @@
+#compdef systemd-cat systemd-ask-password systemd-cgls systemd-cgtop systemd-detect-virt systemd-machine-id-setup systemd-notify systemd-tty-ask-password-agent -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+local curcontext="$curcontext" state lstate line
+case "$service" in
+ systemd-ask-password)
+ _arguments \
+ {-h,--help}'[Show this help]' \
+ '--icon=[Icon name]:icon name:' \
+ '--timeout=[Timeout in sec]:timeout (seconds):' \
+ '--no-tty[Ask question via agent even on TTY]' \
+ '--accept-cached[Accept cached passwords]' \
+ '--multiple[List multiple passwords if available]'
+ ;;
+ systemd-cat)
+ _arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Show package version.]' \
+ {-t+,--identifier=}'[Set syslog identifier.]:syslog identifier:' \
+ {-p+,--priority=}'[Set priority value.]:value:({0..7})' \
+ '--level-prefix=[Control whether level prefix shall be parsed.]:boolean:(1 0)' \
+ ':Message'
+ ;;
+ systemd-cgls)
+ _arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Show package version]' \
+ '--no-pager[Do not pipe output into a pager]' \
+ {-a,--all}'[Show all groups, including empty]' \
+ '-k[Include kernel threads in output]' \
+ ':cgroups:(cpuset cpu cpuacct memory devices freezer blkio)'
+ ;;
+ systemd-cgtop)
+ _arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Print version and exit]' \
+ '(-c -m -i -t)-p[Order by path]' \
+ '(-c -p -m -i)-t[Order by number of tasks]' \
+ '(-m -p -i -t)-c[Order by CPU load]' \
+ '(-c -p -i -t)-m[Order by memory load]' \
+ '(-c -m -p -t)-i[Order by IO load]' \
+ {-d+,--delay=}'[Specify delay]:delay:' \
+ {-n+,--iterations=}'[Run for N iterations before exiting]:number of iterations:' \
+ {-b,--batch}'[Run in batch mode, accepting no input]' \
+ '--depth=[Maximum traversal depth]:maximum depth:'
+ ;;
+ systemd-detect-virt)
+ _arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Show package version]' \
+ {-c,--container}'[Only detect whether we are run in a container]' \
+ {-v,--vm}'[Only detect whether we are run in a VM]' \
+ {-q,--quiet}"[Don't output anything, just set return value]"
+ ;;
+ systemd-machine-id-setup)
+ _arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Show package version]'
+ ;;
+ systemd-notify)
+ _arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Show package version]' \
+ '--ready[Inform the init system about service start-up completion.]' \
+ '--pid=[Inform the init system about the main PID of the daemon]:daemon main PID:_pids' \
+ '--status=[Send a free-form status string for the daemon to the init systemd]:status string:' \
+ '--booted[Returns 0 if the system was booted up with systemd]'
+ ;;
+ systemd-tty-ask-password-agent)
+ _arguments \
+ {-h,--help}'[Prints a short help text and exits.]' \
+ '--version[Prints a short version string and exits.]' \
+ '--list[Lists all currently pending system password requests.]' \
+ '--query[Process all currently pending system password requests by querying the user on the calling TTY.]' \
+ '--watch[Continuously process password requests.]' \
+ '--wall[Forward password requests to wall(1).]' \
+ '--plymouth[Ask question with plymouth(8).]' \
+ '--console[Ask question on /dev/console.]'
+ ;;
+ *) _message 'eh?' ;;
+esac
diff --git a/shell-completion/zsh/_systemd-analyze b/shell-completion/zsh/_systemd-analyze
new file mode 100644
index 0000000..188d6b7
--- /dev/null
+++ b/shell-completion/zsh/_systemd-analyze
@@ -0,0 +1,99 @@
+#compdef systemd-analyze -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+(( $+functions[_systemd-analyze_log-level] )) ||
+ _systemd-analyze_log-level() {
+ local -a _levels
+ _levels=(debug info notice warning err crit alert emerg)
+ _describe -t level 'logging level' _levels || compadd "$@"
+ }
+
+(( $+functions[_systemd-analyze_log-target] )) ||
+ _systemd-analyze_log-target() {
+ local -a _targets
+ _targets=(console journal kmsg journal-or-kmsg null)
+ _describe -t target 'logging target' _targets || compadd "$@"
+ }
+
+(( $+functions[_systemd-analyze_verify] )) ||
+ _systemd-analyze_verify() {
+ _sd_unit_files
+ }
+
+(( $+functions[_systemd-analyze_service-watchdogs] )) ||
+ _systemd-analyze_service-watchdogs() {
+ local -a _states
+ _states=(on off)
+ _describe -t state 'state' _states || compadd "$@"
+ }
+
+(( $+functions[_systemd-analyze_cat-config] )) ||
+ _systemd-analyze_cat-config() {
+ _files -W '(/run/systemd/ /etc/systemd/ /usr/lib/systemd/)' -P 'systemd/'
+ }
+
+(( $+functions[_systemd-analyze_security] )) ||
+ _systemd-analyze_security() {
+ _sd_unit_files
+ }
+
+(( $+functions[_systemd-analyze_commands] )) ||
+ _systemd-analyze_commands(){
+ local -a _systemd_analyze_cmds
+ # Descriptions taken from systemd-analyze --help.
+ _systemd_analyze_cmds=(
+ 'time:Print time spent in the kernel before reaching userspace'
+ 'blame:Print list of running units ordered by time to init'
+ 'critical-chain:Print a tree of the time critical chain of units'
+ 'plot:Output SVG graphic showing service initialization'
+ 'dot:Dump dependency graph (in dot(1) format)'
+ 'dump:Dump server status'
+ 'cat-config:Cat systemd config files'
+ 'unit-files:List files and symlinks for units'
+ 'unit-paths:List unit load paths'
+ 'exit-status:List known exit statuses'
+ 'syscall-filter:List syscalls in seccomp filter'
+ 'condition:Evaluate Condition*= and Assert*= assignments'
+ 'verify:Check unit files for correctness'
+ 'calendar:Validate repetitive calendar time events'
+ 'timestamp:Parse a systemd syntax timestamp'
+ 'timespan:Parse a systemd syntax timespan'
+ 'security:Analyze security settings of a service'
+ # 'log-level:Get/set systemd log threshold'
+ # 'log-target:Get/set systemd log target'
+ # 'service-watchdogs:Get/set service watchdog status'
+ )
+
+ if (( CURRENT == 1 )); then
+ _describe "options" _systemd_analyze_cmds
+ else
+ local curcontext="$curcontext"
+ cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}"
+ if (( $#cmd )); then
+ if (( $+functions[_systemd-analyze_$cmd] )) && (( CURRENT == 2 )); then
+ _systemd-analyze_$cmd
+ else
+ _message "no more options"
+ fi
+ else
+ _message "unknown systemd-analyze command: $words[1]"
+ fi
+ fi
+ }
+
+_arguments \
+ {-h,--help}'[Show help text]' \
+ '--version[Show package version]' \
+ '--system[Operate on system systemd instance]' \
+ '--user[Operate on user systemd instance]' \
+ '--global[Show global user instance config]' \
+ '--no-pager[Do not pipe output into a pager]' \
+ '--man=[Do (not) check for existence of man pages]:boolean:(1 0)' \
+ '--order[When generating graph for dot, show only order]' \
+ '--require[When generating graph for dot, show only requirement]' \
+ '--fuzz=[When printing the tree of the critical chain, print also services, which finished TIMESPAN earlier, than the latest in the branch]:TIMESPAN' \
+ '--from-pattern=[When generating a dependency graph, filter only origins]:GLOB' \
+ '--to-pattern=[When generating a dependency graph, filter only destinations]:GLOB' \
+ {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
+ {-M+,--machine=}'[Operate on local container]:machine:_sd_machines' \
+ '*::systemd-analyze commands:_systemd-analyze_commands'
diff --git a/shell-completion/zsh/_systemd-delta b/shell-completion/zsh/_systemd-delta
new file mode 100644
index 0000000..5cd140d
--- /dev/null
+++ b/shell-completion/zsh/_systemd-delta
@@ -0,0 +1,17 @@
+#compdef systemd-delta -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+(( $+functions[_systemd-delta_types] )) ||
+_systemd-delta_types() {
+ local -a _delta_types
+ _delta_types=(masked equivalent redirected overridden unchanged)
+ _values -s , "${_delta_types[@]}"
+}
+
+_arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Show package version]' \
+ '--no-pager[Do not pipe output into a pager]' \
+ '--diff=[Show a diff when overridden files differ]:boolean:(1 0)' \
+ {-t+,--type=}'[Only display a selected set of override types]:types:_systemd-delta_types' \
+ ':SUFFIX:(tmpfiles.d sysctl.d systemd/system)'
diff --git a/shell-completion/zsh/_systemd-inhibit b/shell-completion/zsh/_systemd-inhibit
new file mode 100644
index 0000000..1ff8487
--- /dev/null
+++ b/shell-completion/zsh/_systemd-inhibit
@@ -0,0 +1,36 @@
+#compdef systemd-inhibit -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+(( $+functions[_systemd-inhibit_commands] )) ||
+_systemd-inhibit_commands(){
+ if (( CURRENT == 1 )); then
+ compset -q
+ _normal
+ else
+ local n=${words[(b:2:i)[^-]*]}
+ if (( n <= CURRENT )); then
+ compset -n $n
+ _alternative \
+ 'files:file:_files' \
+ 'commands:command:_normal' && return 0
+ fi
+ _default
+ fi
+}
+
+(( $+functions[_systemd-inhibit_what] )) ||
+_systemd-inhibit_what() {
+ local _inhibit
+ _inhibit=(shutdown sleep idle handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)
+ _values -s : "${_inhibit[@]}"
+}
+
+_arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Show package version]' \
+ '--what=[Operations to inhibit]:options:_systemd-inhibit_what' \
+ '--who=[A descriptive string who is inhibiting]:who is inhibiting:' \
+ '--why=[A descriptive string why is being inhibited]:reason for the lock:' \
+ '--mode=[One of block or delay]:lock mode:( block delay )' \
+ '--list[List active inhibitors]' \
+ '*:commands:_systemd-inhibit_commands'
diff --git a/shell-completion/zsh/_systemd-nspawn b/shell-completion/zsh/_systemd-nspawn
new file mode 100644
index 0000000..d3cf060
--- /dev/null
+++ b/shell-completion/zsh/_systemd-nspawn
@@ -0,0 +1,52 @@
+#compdef systemd-nspawn -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+(( $+functions[_systemd-nspawn_caps] )) ||
+_systemd-nspawn_caps(){
+ local -a _caps
+ _caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
+ CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE CAP_LINUX_IMMUTABLE
+ CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID CAP_SETFCAP CAP_SETPCAP
+ CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
+ CAP_SYS_RESOURCE CAP_SYS_BOOT )
+ _values -s , 'capabilities' "$_caps[@]"
+}
+
+_arguments \
+ {-h,--help}'[Show this help.]' \
+ '--version[Print a short version string and exit.]' \
+ {--quiet,-q}'[Turns off any status output by the tool itself.]' \
+ {--directory=,-D+}'[Directory to use as file system root for the namespace container. If omitted the current directory will be used.]:directories:_directories' \
+ '--template=[Initialize root directory from template directory, if missing.]:template:_directories' \
+ {--ephemeral,-x}'[Run container with snapshot of root directory, and remove it after exit.]' \
+ {--image=,-i+}'[Disk image to mount the root directory for the container from.]:disk image: _files' \
+ {--boot,-b}'[Automatically search for an init binary and invoke it instead of a shell or a user supplied program.]' \
+ {--user=,-u+}'[Run the command under specified user, create home directory and cd into it.]:user:_users' \
+ {--machine=,-M+}'[Sets the machine name for this container.]: : _message "container name"' \
+ '--uuid=[Set the specified uuid for the container.]: : _message "container UUID"' \
+ {--slice=,-S+}'[Make the container part of the specified slice, instead of the default machine.slice.]: : _message slice' \
+ '--private-network[Disconnect networking of the container from the host.]' \
+ '--network-interface=[Assign the specified network interface to the container.]: : _net_interfaces' \
+ '--network-macvlan=[Create a "macvlan" interface of the specified Ethernet network interface and add it to the container.]: : _net_interfaces' \
+ '--network-ipvlan=[Create a ipvlan network interface based on an existing network interface to the container.]: : _net_interfaces' \
+ {--network-veth,-n}'[Create a virtual Ethernet link (veth) between host and container.]' \
+ '--network-bridge=[Adds the host side of the Ethernet link created with --network-veth to the specified bridge.]: : _net_interfaces' \
+ {--port=,-p+}'[Expose a container IP port on the host.]: : _message port' \
+ {--selinux-context=,-Z+}'[Sets the SELinux security context to be used to label processes in the container.]: : _message "SELinux context"' \
+ {--selinux-apifs-context=,-L+}'[Sets the SELinux security context to be used to label files in the virtual API file systems in the container.]: : _message "SELinux context"' \
+ '--capability=[List one or more additional capabilities to grant the container.]:capabilities:_systemd-nspawn_caps' \
+ '--drop-capability=[Specify one or more additional capabilities to drop for the containerm]:capabilities:_systemd-nspawn_caps' \
+ "--link-journal=[Control whether the container's journal shall be made visible to the host system.]:options:(no host guest auto)" \
+ '-j[Equivalent to --link-journal=guest.]' \
+ '--read-only[Mount the root file system read only for the container.]' \
+ '--bind=[Bind mount a file or directory from the host into the container.]: : _files' \
+ '--bind-ro=[Bind mount a file or directory from the host into the container (read-only).]: : _files' \
+ '--tmpfs=[Mount an empty tmpfs to the specified directory.]: : _files' \
+ '--setenv=[Specifies an environment variable assignment to pass to the init process in the container, in the format "NAME=VALUE".]: : _message "environment variables"' \
+ '--share-system[Allows the container to share certain system facilities with the host.]' \
+ '--register=[Controls whether the container is registered with systemd-machined(8).]:systemd-machined registration:( yes no )' \
+ '--keep-unit[Instead of creating a transient scope unit to run the container in, simply register the service or scope unit systemd-nspawn has been invoked in with systemd-machined(8).]' \
+ '--personality=[Control the architecture ("personality") reported by uname(2) in the container.]:architecture:(x86 x86-64)' \
+ '--volatile=[Run the system in volatile mode.]:volatile:(no yes state)' \
+ "--notify-ready=[Control when the ready notification is sent]:options:(yes no)" \
+ '*:: : _normal'
diff --git a/shell-completion/zsh/_systemd-path b/shell-completion/zsh/_systemd-path
new file mode 100644
index 0000000..dd2e720
--- /dev/null
+++ b/shell-completion/zsh/_systemd-path
@@ -0,0 +1,8 @@
+#compdef systemd-path
+
+typeset -A sdpath=( ${$(systemd-path)/:/} )
+_arguments -S \
+ '(-h --help)'{-h,--help}'[Print help text and exit]' \
+ '(-v --version)'{-v,--version}'[Print a version string and exit]' \
+ '--suffix=[Append a suffix to the paths]' \
+ '*:pathname:compadd -k sdpath'
diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run
new file mode 100644
index 0000000..d9998e5
--- /dev/null
+++ b/shell-completion/zsh/_systemd-run
@@ -0,0 +1,65 @@
+#compdef systemd-run -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+# @todo _systemctl has a helper with the same name, so we must redefine
+__systemctl() {
+ local -a _modes
+ _modes=("--user" "--system")
+ systemctl ${words:*_modes} --full --no-legend --no-pager --plain "$@" 2>/dev/null
+}
+
+(( $+functions[__systemd-run_get_slices] )) ||
+ __systemd-run_get_slices () {
+ __systemctl list-units --all -t slice \
+ | { while read -r a b; do echo $a; done; };
+ }
+
+(( $+functions[__systemd-run_slices] )) ||
+ __systemd-run_slices () {
+ local -a _slices
+ _slices=(${(fo)"$(__systemd-run_get_slices)"})
+ typeset -U _slices
+ _describe 'slices' _slices
+ }
+
+_arguments \
+ {-h,--help}'[Show help message]' \
+ '--version[Show package version]' \
+ '--user[Run as user unit]' \
+ {-H+,--host=}'[Operate on remote host]:[user@]host:_sd_hosts_or_user_at_host' \
+ {-M+,--machine=}'[Operate on local container]:machines:_sd_machines' \
+ '--scope[Run this as scope rather than service]' \
+ '--unit=[Run under the specified unit name]:unit name' \
+ {-p+,--property=}'[Set unit property]:NAME=VALUE:(( \
+ CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= \
+ SendSIGKILL= MemoryLimit= CPUShares= BlockIOWeight= User= Group= \
+ DevicePolicy= KillMode= DeviceAllow= BlockIOReadBandwidth= \
+ BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= \
+ KillSignal= RestartKillSignal= FinalKillSignal= LimitCPU= LimitFSIZE= LimitDATA= \
+ LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= \
+ LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= \
+ LimitNICE= LimitRTPRIO= LimitRTTIME= PrivateTmp= PrivateDevices= \
+ PrivateNetwork= NoNewPrivileges= WorkingDirectory= RootDirectory= \
+ TTYPath= SyslogIdentifier= SyslogLevelPrefix= SyslogLevel= \
+ SyslogFacility= TimerSlackNSec= OOMScoreAdjust= ReadWritePaths= \
+ ReadOnlyPaths= InaccessiblePaths= EnvironmentFile= \
+ ProtectSystem= ProtectHome= RuntimeDirectory= PassEnvironment= \
+ ))' \
+ '--description=[Description for unit]:description' \
+ '--slice=[Run in the specified slice]:slices:__systemd-run_slices' \
+ {-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \
+ '--send-sighup[Send SIGHUP when terminating]' \
+ '--service-type=[Service type]:type:(simple forking oneshot dbus notify idle)' \
+ '--uid=[Run as system user]:user:_users' \
+ '--gid=[Run as system group]:group:_groups' \
+ '--nice=[Nice level]:nice level' \
+ '--setenv=[Set environment]:NAME=VALUE' \
+ '--on-active=[Run after SEC seconds]:SEC' \
+ '--on-boot=[Run SEC seconds after machine was booted up]:SEC' \
+ '--on-startup=[Run SEC seconds after systemd was first started]:SEC' \
+ '--on-unit-active=[Run SEC seconds after the last activation]:SEC' \
+ '--on-unit-inactive=[Run SEC seconds after the last deactivation]:SEC' \
+ '--on-calendar=[Realtime timer]:SPEC' \
+ '--timer-property=[Set timer unit property]:NAME=VALUE' \
+ '--wait=[Wait until service stopped again]' \
+ '*::command:_command'
diff --git a/shell-completion/zsh/_systemd-tmpfiles b/shell-completion/zsh/_systemd-tmpfiles
new file mode 100644
index 0000000..8a23360
--- /dev/null
+++ b/shell-completion/zsh/_systemd-tmpfiles
@@ -0,0 +1,14 @@
+#compdef systemd-tmpfiles -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+_arguments \
+ {-h,--help}'[Show help]' \
+ '--version[Show package version]' \
+ '--create[Create, set ownership/permissions based on the config files.]' \
+ '--clean[Clean up all files and directories with an age parameter configured.]' \
+ '--remove[All files and directories marked with r, R in the configuration files are removed.]' \
+ '--boot[Execute actions only safe at boot]' \
+ '--prefix=[Only apply rules that apply to paths with the specified prefix.]' \
+ '--exclude-prefix=[Ignore rules that apply to paths with the specified prefix.]' \
+ '--root=[Operate on an alternate filesystem root]:directory:_directories' \
+ '*::files:_files'