mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-04 03:56:26 +08:00
completions/zfs: Check for zpool
This is an additional tool, and this function is executed on source time so we'd spew errors. (also remove an ineffective line - it's probably *nicer* with the read, but that's not what's currently effectively doing anything)
This commit is contained in:
parent
7d7b72f995
commit
85504ca694
@ -1,4 +1,6 @@
|
|||||||
function __fish_is_zfs_feature_enabled -a feature target -d "Returns 0 if the given ZFS feature is available or enabled for the given full-path target (zpool or dataset), or any target if none given"
|
function __fish_is_zfs_feature_enabled -a feature target -d "Returns 0 if the given ZFS feature is available or enabled for the given full-path target (zpool or dataset), or any target if none given"
|
||||||
|
type -q zpool
|
||||||
|
or return
|
||||||
set -l pool (string replace -r '/.*' '' -- $target)
|
set -l pool (string replace -r '/.*' '' -- $target)
|
||||||
set -l feature_name ""
|
set -l feature_name ""
|
||||||
if test -z "$pool"
|
if test -z "$pool"
|
||||||
@ -9,7 +11,6 @@ function __fish_is_zfs_feature_enabled -a feature target -d "Returns 0 if the gi
|
|||||||
if test $status -ne 0 # No such feature
|
if test $status -ne 0 # No such feature
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
echo $feature_name | read -l _ _ state _
|
|
||||||
set -l state (echo $feature_name | cut -f3)
|
set -l state (echo $feature_name | cut -f3)
|
||||||
string match -qr '(active|enabled)' -- $state
|
string match -qr '(active|enabled)' -- $state
|
||||||
return $status
|
return $status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user