Move __fish_print_zfs_* into zfs completion script

This commit is contained in:
Jason 2019-12-03 19:40:44 +09:00 committed by Fabian Homborg
parent 69dccce937
commit 965b142acd
4 changed files with 15 additions and 12 deletions

View file

@ -1,5 +1,5 @@
# Fish completions for the OpenZFS zfs command
# Possible enhancements:
# TODO Possible enhancements:
# - add a test to propose iSCSI and Trusted Extensions completions only when such system is present;
# - Illumos man pages suggests that it does not support nbmand nor atime mount option, so these properties should be proposed only when available
# - generally, propose properties only when the current OS and ZFS versions support them;
@ -200,6 +200,20 @@ function __fish_zfs_list_permissions
end | string match -r '@[[:alnum:]]*' | sort -u
end
function __fish_print_zfs_bookmarks -d "Lists ZFS bookmarks, if the feature is enabled"
if __fish_is_zfs_feature_enabled 'feature@bookmarks'
zfs list -t bookmark -o name -H
end
end
function __fish_print_zfs_filesystems -d "Lists ZFS filesystems"
zfs list -t filesystem -o name -H
end
function __fish_print_zfs_volumes -d "Lists ZFS volumes"
zfs list -t volume -o name -H
end
complete -c zfs -f -n '__fish_zfs_needs_command' -s '?' -a '?' -d 'Display a help message'
complete -c zfs -f -n '__fish_zfs_needs_command' -a 'create' -d 'Create a volume or filesystem'
complete -c zfs -f -n '__fish_zfs_needs_command' -a 'destroy' -d 'Destroy a dataset'

View file

@ -1,5 +0,0 @@
function __fish_print_zfs_bookmarks -d "Lists ZFS bookmarks, if the feature is enabled"
if __fish_is_zfs_feature_enabled 'feature@bookmarks'
zfs list -t bookmark -o name -H
end
end

View file

@ -1,3 +0,0 @@
function __fish_print_zfs_filesystems -d "Lists ZFS filesystems"
zfs list -t filesystem -o name -H
end

View file

@ -1,3 +0,0 @@
function __fish_print_zfs_volumes -d "Lists ZFS volumes"
zfs list -t volume -o name -H
end