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
(( $+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] )) ||