mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
shell-completion/zsh: complete hidden images when word starts with "."
Show hidden images in the completion results, but only if the current word starts with ".", such that - `machinectl clone <Tab>` will only offer non-hidden images, but - `machinectl clone .<Tab>` will offer both hidden and non-hidden images
This commit is contained in:
parent
57d389c3fb
commit
9a887b1421
@ -3,7 +3,12 @@
|
||||
|
||||
(( $+functions[__machinectl_get_images] )) ||
|
||||
__machinectl_get_images () {
|
||||
machinectl --no-legend list-images | {while read -r a b; do echo $a; done;}
|
||||
local -a flags
|
||||
if [[ $PREFIX == .* ]]; then flags=( --all ); fi
|
||||
machinectl --no-legend list-images $flags | {while read -r a b; do
|
||||
# escape : and \; do not interpret existing escape sequences
|
||||
printf -- "%s\n" ${a//(#b)(\\|:)/\\$match}
|
||||
done;}
|
||||
}
|
||||
|
||||
(( $+functions[_machinectl_images] )) ||
|
||||
|
Loading…
Reference in New Issue
Block a user