From c560240abc04819992c5dccae98eb1d984d7bb1d Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 25 Oct 2020 21:50:44 -0500 Subject: [PATCH] [zpool] Improve ZFS completions Do not show devices already part of a zpool on calls to `zpool add` and the converse. --- share/completions/zpool.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/completions/zpool.fish b/share/completions/zpool.fish index 387a10d5a..00de7cf55 100644 --- a/share/completions/zpool.fish +++ b/share/completions/zpool.fish @@ -205,8 +205,8 @@ if test $OS = Linux complete -c zpool -f -n '__fish_zpool_using_command add' -s P -d 'Display device full path' complete -c zpool -x -n '__fish_zpool_using_command add' -s o -d 'Pool property' -a '(__fish_zpool_list_device_properties)' end -complete -c zpool -x -n '__fish_zpool_using_command add' -d 'Pool to add virtual devices to' -a '(__fish_complete_zfs_pools)' -complete -c zpool -x -n '__fish_zpool_using_command add' -d 'Virtual device to add' -a '(__fish_zpool_complete_vdevs)' +complete -c zpool -x -n '__fish_zpool_using_command add; and __fish_prev_arg_in add' -d 'Pool to add virtual devices to' -a '(__fish_complete_zfs_pools)' +complete -c zpool -x -n '__fish_zpool_using_command add; and not __fish_prev_arg_in add' -d 'Virtual device to add' -a '(__fish_zpool_complete_vdevs)' # attach completions complete -c zpool -f -n '__fish_zpool_using_command attach' -s f -d 'Force use of virtual device'