diff options
Diffstat (limited to '')
-rw-r--r-- | shell-completion/zsh/_systemd | 81 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-analyze | 113 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-delta | 17 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-inhibit | 36 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-nspawn | 53 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-path | 9 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-run | 81 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-tmpfiles | 14 |
8 files changed, 404 insertions, 0 deletions
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd new file mode 100644 index 0000000..8636315 --- /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 +# 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..e305995 --- /dev/null +++ b/shell-completion/zsh/_systemd-analyze @@ -0,0 +1,113 @@ +#compdef systemd-analyze +# SPDX-License-Identifier: LGPL-2.1-or-later + +(( $+functions[_systemd-analyze_verify] )) || + _systemd-analyze_verify() { + _sd_unit_files + } + +(( $+functions[_systemd-analyze_cat-config] )) || + _systemd-analyze_cat-config() { + _files -W '(/run/systemd/ /etc/systemd/ /usr/lib/systemd/)' -P 'systemd/' + } + +(( $+functions[_systemd-analyze_critical-chain] )) || + _systemd-analyze_critical-chain() { + local -a _units + systemctl list-units --no-legend --no-pager --plain --all | + while read -r a b c; do + _units+=($a) + done + compadd -a _units + } + +(( $+functions[_systemd-analyze_security] )) || + _systemd-analyze_security() { + _sd_unit_files + } + +(( $+functions[_systemd-analyze_syscall-filter] )) || + _systemd-analyze_syscall-filter() { + local -a _groups + _groups=( $(systemd-analyze --quiet --no-pager syscall-filter | grep '^@') ) + _describe -t groups 'syscall groups' _groups || compadd "$@" + } + +(( $+functions[_systemd-analyze_filesystems] )) || + _systemd-analyze_filesystems() { + local -a _groups + _groups=( $(systemd-analyze --quiet --no-pager filesystems | grep '^@') ) + _describe -t groups 'file system groups' _groups || compadd "$@" + } + +(( $+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' + 'capability:List capability definitions' + 'syscall-filter:List syscalls in seccomp filters' + 'filesystems:List known filesystems' + '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' + 'inspect-elf:Parse and print ELF package metadata' + # log-level, log-target, service-watchdogs have been deprecated + ) + + 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]' \ + '--root=[Add support for root argument]:PATH' \ + '--image=[Add support for discrete images]:PATH' \ + '--recursive-errors=[When verifying a unit, control dependency verification]:MODE' \ + '--offline=[Perform a security review of the specified unit files]:BOOL:(yes no)' \ + '--threshold=[Set a value to compare the overall security exposure level with]: NUMBER' \ + '--security-policy=[Use customized requirements to compare unit files against]: PATH' \ + '--json=[Generate a JSON output of the security analysis table]:MODE:(pretty short off)' \ + '--profile=[Include the specified profile in the security review of units]: PATH' \ + '--no-pager[Do not pipe output into a pager]' \ + '--man=[Do (not) check for existence of man pages]:BOOL:(yes no)' \ + '--generators=[Do (not) run unit generators]:BOOL:(yes no)' \ + '--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' \ + '--quiet[Do not show hints]' \ + '*::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..7d7456b --- /dev/null +++ b/shell-completion/zsh/_systemd-delta @@ -0,0 +1,17 @@ +#compdef systemd-delta +# 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..059ef9e --- /dev/null +++ b/shell-completion/zsh/_systemd-inhibit @@ -0,0 +1,36 @@ +#compdef systemd-inhibit +# 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..adc5d7c --- /dev/null +++ b/shell-completion/zsh/_systemd-nspawn @@ -0,0 +1,53 @@ +#compdef systemd-nspawn +# 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 an "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)" \ + "--suppress-sync=[Control whether to suppress disk synchronization for the container payload]:options:(yes no)" \ + '*:: : _normal' diff --git a/shell-completion/zsh/_systemd-path b/shell-completion/zsh/_systemd-path new file mode 100644 index 0000000..d1fb24b --- /dev/null +++ b/shell-completion/zsh/_systemd-path @@ -0,0 +1,9 @@ +#compdef systemd-path +# SPDX-License-Identifier: LGPL-2.1-or-later + +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..7568ed4 --- /dev/null +++ b/shell-completion/zsh/_systemd-run @@ -0,0 +1,81 @@ +#compdef systemd-run +# 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 \ + {-G,--collect}'[Unload the transient unit after it completed]' \ + '--description=[Description for unit]:description' \ + '--gid=[Run as system group]:group:_groups' \ + {-h,--help}'[Show help message]' \ + {-H+,--host=}'[Operate on remote host]:[user@]host:_sd_hosts_or_user_at_host' \ + {-M+,--machine=}'[Operate on local container]:machines:_sd_machines' \ + '--nice=[Nice level]:nice level' \ + '--no-ask-password[Do not query the user for authentication]' \ + '--no-block[Do not synchronously wait for the unit start operation to finish]' \ + '--on-active=[Run after SEC seconds]:SEC' \ + '--on-boot=[Run SEC seconds after machine was booted up]:SEC' \ + '--on-calendar=[Realtime timer]:SPEC' \ + '--on-clock-change[Defines a trigger based on system clock jumps]' \ + '--on-startup=[Run SEC seconds after systemd was first started]:SEC' \ + '--on-timezone-change[Defines a trigger based on system timezone changes]' \ + '--on-unit-active=[Run SEC seconds after the last activation]:SEC' \ + '--on-unit-inactive=[Run SEC seconds after the last deactivation]:SEC' \ + '--path-property=[Set path unit property]:NAME=VALUE' \ + {-P,--pipe}'[Inherit standard input, output, and error]' \ + {-p+,--property=}'[Set unit property]:NAME=VALUE:(( \ + CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= \ + SendSIGKILL= MemoryLimit= CPUShares= BlockIOWeight= User= Group= \ + DevicePolicy= KillMode= ExitType= 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= \ + ))' \ + {-t,--pty}'[The service connects to the terminal]' \ + {-q,--quiet}'[Suppresses additional informational output]' \ + {-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \ + {-d,--same-dir}'[Run on the current working directory]' \ + '--scope[Run this as scope rather than service]' \ + '--send-sighup[Send SIGHUP when terminating]' \ + '--service-type=[Service type]:type:(simple forking oneshot dbus notify idle)' \ + {-E+,--setenv=}'[Set environment]:NAME=VALUE' \ + {-S,--shell}'[requests an interactive shell in the current working directory]' \ + '--slice=[Run in the specified slice]:slices:__systemd-run_slices' \ + '--slice-inherit[Run in the inherited slice]' \ + '--socket-property=[Set socket unit property]:NAME=VALUE' \ + '--system[Run as system unit]' \ + '--timer-property=[Set timer unit property]:NAME=VALUE' \ + '--uid=[Run as system user]:user:_users' \ + {-u+,--unit=}'[Run under the specified unit name]:unit name' \ + '--user[Run as user unit]' \ + '--version[Show package version]' \ + '--wait=[Wait until service stopped again]' \ + '--working-directory=[Run with the specified working directory]' \ + '(-):command: _command_names -e' \ + '*::arguments:_normal' diff --git a/shell-completion/zsh/_systemd-tmpfiles b/shell-completion/zsh/_systemd-tmpfiles new file mode 100644 index 0000000..6c9094a --- /dev/null +++ b/shell-completion/zsh/_systemd-tmpfiles @@ -0,0 +1,14 @@ +#compdef systemd-tmpfiles +# 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' |