CLI for inspecting and using storage providers. Scans /run/systemd/io.systemd.StorageProvider/ (or the user-mode equivalent) for AF_UNIX sockets and talks to each one over Varlink. Verbs: "volumes" lists volumes across all providers, "templates" lists supported creation templates, "providers" lists the endpoints themselves. Also installed as a mount.storage helper, so 'mount -t storage PROVIDER:VOLUME /mnt' (or 'mount -t storage.<fstype>' to put a fresh filesystem on a block volume) acquires the volume and mounts it. Ships with bash/zsh completions and a man page.
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
#compdef storagectl
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
(( $+functions[_storagectl_commands] )) || _storagectl_commands()
|
|
{
|
|
local -a _storagectl_cmds
|
|
_storagectl_cmds=(
|
|
"volumes:List storage volumes"
|
|
"templates:List storage volume templates"
|
|
"providers:List storage providers"
|
|
"help:Prints a short help text and exits"
|
|
)
|
|
if (( CURRENT == 1 )); then
|
|
_describe -t commands 'storagectl command' _storagectl_cmds
|
|
else
|
|
local curcontext="$curcontext"
|
|
cmd="${${_storagectl_cmds[(r)$words[1]:*]%%:*}}"
|
|
if (( $+functions[_storagectl_$cmd] )); then
|
|
_storagectl_$cmd
|
|
else
|
|
_message "no more options"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
_arguments \
|
|
'(- *)'{-h,--help}'[Prints a short help text and exits.]' \
|
|
'(- *)--version[Prints a short version string and exits.]' \
|
|
'--no-pager[Do not pipe output into a pager]' \
|
|
'--no-legend[Do not show the headers and footers]' \
|
|
'--no-ask-password[Do not query the user for authentication]' \
|
|
'--json=[Show output as JSON]:mode:(pretty short off help)' \
|
|
'--system[Operate in system mode]' \
|
|
'--user[Operate in user mode]' \
|
|
'*::storagectl command:_storagectl_commands'
|