diff --git a/share/completions/pygmentize.fish b/share/completions/pygmentize.fish index 8e3c0fe7a..4f4cb6042 100644 --- a/share/completions/pygmentize.fish +++ b/share/completions/pygmentize.fish @@ -3,9 +3,9 @@ function __fish_print_pygmentize while set -q lines[2] set -l names (string split ", " $lines[1]) - for name in $names + for name in $names printf '%s\t%s\n' $name $lines[2] - end + end set -e lines[1] set -e lines[1] diff --git a/share/functions/__fish_print_VBox_vms.fish b/share/functions/__fish_print_VBox_vms.fish new file mode 100644 index 000000000..3f7e04329 --- /dev/null +++ b/share/functions/__fish_print_VBox_vms.fish @@ -0,0 +1,29 @@ +function __fish_print_VBox_vms + set -l print_names true + set -l print_uuids true + + if contains -- nouuids $argv + set print_uuids false + end + + if contains -- nonames $argv + set print_names false + end + + # `VBoxManage list vms` output example: + # "Machine Name" {222537b0-1ea1-454a-abf0-ed0d6c3c6346} + # "Another Machine" {332537b4-1ea1-454a-abf0-ed1d6c3c2347} + set -l lines (VBoxManage list vms | string match -r '"(.*)" {(.*)}') + + while set -q lines[3] + if test $print_names = true + printf '%s\tVirtual machine\n' $lines[2] + end + + if test $print_uuids = true + printf '%s\t%s virtual machine\n' $lines[3] $lines[2] + end + + set -e lines[1..3] + end +end