From b7db397f61f603c6bb4d7707e5010728065c503b Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 26 May 2018 12:20:04 -0500 Subject: [PATCH] Fix zfs completions under FreeBSD Under FreeBSD, as annoying as it is, switches must directly follow the command or subcommand in question, and cannot come after actual payload argument. Calling `zpool get all -H` instead of `zpool get -H all` caused error messages to be spewed to the console under FreeBSD when simply completing `zfs `, this should fix that. The change should also be compatible with other operating systems (namely Linux) that don't have this requirement, as they (generally) allow arguments to come before _or_ after the primary non-switch argument (though I do not have access to a zfs-enabled Linux machine to test this). --- share/functions/__fish_is_zfs_feature_enabled.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_is_zfs_feature_enabled.fish b/share/functions/__fish_is_zfs_feature_enabled.fish index 4f871b0ed..d6f02af7c 100644 --- a/share/functions/__fish_is_zfs_feature_enabled.fish +++ b/share/functions/__fish_is_zfs_feature_enabled.fish @@ -2,9 +2,9 @@ function __fish_is_zfs_feature_enabled -a feature target -d "Returns 0 if the gi set -l pool (string replace -r '/.*' '' -- $target) set -l feature_name "" if test -z "$pool" - set feature_name (zpool get all -H | string match -r "\s$feature\s") + set feature_name (zpool get -H all | string match -r "\s$feature\s") else - set feature_name (zpool get all -H $pool | string match -r "$pool\s$feature\s") + set feature_name (zpool get -H all $pool | string match -r "$pool\s$feature\s") end if test $status -ne 0 # No such feature return 1