# - 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;
# - for the promote command, propose only eligible filesystems;
# - for the rollback command, propose only the most recent snapshot for each dataset, as it will not accept an intermediary snapshot;
# - for the release command, complete with existing tags;
# - for the diff command, complete the destination dataset of the diff;
# - for the program command, complete the script to be executed
# - for commands accepting several arguments of different types, propose arguments in the right order: for get, once the ZFS parameters have been given, only propose datasets
setOS""
switch(uname)
case Linux
setOS"Linux"
case Darwin
setOS"macOS"
case FreeBSD
setOS"FreeBSD"
case SunOS
setOS"SunOS"
# Others?
case"*"
setOS"unknown"
end
function__fish_zfs_append-d"Internal completion function for appending string to the ZFS commandline"
function__fish_zfs_using_command # ZFS command whose completions are looked for
set-lcmd(commandline-opc)
iftest(count$cmd)-eq1# The token can only be 'zfs', so skip
return2
end
iftest$cmd[2]=$argv
return0
else
return1
end
end
function__fish_zfs_list_dataset_types
echo-e"filesystem\t"(_"ZFS filesystem")
echo-e"snapshot\t"(_"ZFS filesystem snapshot")
echo-e"volume\t"(_"ZFS block storage device")
echo-e"bookmark\t"(_"ZFS snapshot bookmark")
echo-e"all\t"(_"Any ZFS dataset")
end
function__fish_zfs_list_source_types
echo-e"local\t"(_"Dataset-specific value")
echo-e"default\t"(_"Default ZFS value")
echo-e"inherited\t"(_"Value inherited from parent dataset")
echo-e"received\t"(_"Value received by 'zfs receive'")
echo-e"temporary\t"(_"Value valid for the current mount")
echo-e"none\t"(_"Read-only value")
end
function__fish_zfs_list_get_fields
echo-e"name\t"(_"Dataset full name")
echo-e"property\t"(_"Property")
echo-e"value\t"(_"Property value")
echo-e"source\t"(_"Property value origin")
end
function__fish_zfs_list_space_fields
echo-e"type\t"(_"Identity type")
echo-e"name\t"(_"Identity name")
echo-e"used\t"(_"Space usage")
echo-e"quota\t"(_"Space quota")
end
function__fish_zfs_list_userspace_types
echo-e"posixuser\t"(_"POSIX user")
echo-e"smbuser\t"(_"Samba user")
echo-e"all\t"(_"Both types")
end
function__fish_zfs_list_groupspace_types
echo-e"posixgroup\t"(_"POSIX group")
echo-e"smbgroup\t"(_"Samba group")
echo-e"all\t"(_"Both types")
end
function__fish_zfs_list_permissions
echo-e"allow\t"(_"Also needs the permission to be allowed")
echo-e"clone\t"(_"Also needs the 'create' and 'mount' permissions in the origin filesystem")
echo-e"create\t"(_"Also needs the 'mount' permission")
echo-e"destroy\t"(_"Also needs the 'mount' permission")
echo-e"mount"
echo-e"promote\t"(_"Also needs the 'promote' and 'mount' permissions in the origin filesystem")
echo-e"receive\t"(_"Also needs the 'create' and 'mount' permissions")
echo-e"rename\t"(_"Also needs the 'create' and 'mount' permissions in the new parent")
echo-e"rollback\t"(_"Also needs the 'mount' permission")
echo-e"send"
echo-e"share\t"(_"For SMB and NFS shares")
echo-e"snapshot\t"(_"Also needs the 'mount' permission")
echo-e"groupquota"
echo-e"groupused"
echo-e"userprop\t"(_"Allows changing any user property")
echo-e"userquota"
echo-e"userused"
# The remaining code of the function is almost a duplicate of __fish_complete_zfs_rw_properties and __fish_complete_zfs_ro_properties, but almost only, hence the duplication
# RO properties
echo-e"volblocksize\t"(_"Volume block size")
# R/W properties
echo-e"aclinherit\t"(_"Inheritance of ACL entries")" (discard, noallow, restricted, passthrough, passthrough-x)"
echo-e"atime\t"(_"Update access time on read")" (on, off)"
echo-e"canmount\t"(_"Is the dataset mountable")" (on, off, noauto)"
complete-c zfs -f-n'__fish_zfs_needs_command'-a'set'-d'Set a dataset property'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'get'-d'Get one or several dataset properties'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'inherit'-d'Set a dataset property to be inherited'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'upgrade'-d'List upgradeable datasets, or upgrade one'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'userspace'-d'Get dataset space consumed by each user'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'groupspace'-d'Get dataset space consumed by each user group'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'mount'-d'Mount a filesystem'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'unmount umount'-d'Unmount a filesystem'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'share'-d'Share a given filesystem, or all of them'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'unshare'-d'Stop sharing a given filesystem, or all of them'
if __fish_is_zfs_feature_enabled 'feature@bookmarks'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'bookmark'-d'Create a bookmark for a snapshot'
end
complete-c zfs -f-n'__fish_zfs_needs_command'-a'send'-d'Output a stream representation of a dataset'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'receive recv'-d'Write on disk a dataset from the stream representation given on standard input'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'allow'-d'Delegate, or display delegations of, rights on a dataset to (groups of) users'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'unallow'-d'Revoke delegations of rights on a dataset from (groups of) users'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'hold'-d'Put a named hold on a snapshot'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'holds'-d'List holds on a snapshot'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'release'-d'Remove a named hold from a snapshot'
complete-c zfs -f-n'__fish_zfs_needs_command'-a'diff'-d'List changed files between a snapshot, and a filesystem or a previous snapshot'
iftest$OS='SunOS'# This is currently only supported under Illumos, but that will probably change
complete-c zfs -f-n'__fish_zfs_needs_command'-a'program'-d'Execute a ZFS Channel Program'
end
# Completions hereafter try to follow the man pages commands order, for maintainability, at the cost of multiple if statements
# create completions
complete-c zfs -f-n'__fish_zfs_using_command create'-s p -d'Create all needed non-existing parent datasets'
iftest$OS='Linux'# Only Linux supports the comma-separated format; others need multiple -o calls
complete-c zfs -x-n'__fish_zfs_using_command create'-s o -d'Dataset property'-a'(__fish_zfs_append (__fish_complete_zfs_rw_properties; __fish_complete_zfs_write_once_properties))'
else
complete-c zfs -x-n'__fish_zfs_using_command create'-s o -d'Dataset property'-a'(__fish_complete_zfs_rw_properties; __fish_complete_zfs_write_once_properties)'
end
# create completions for volumes; as -V is necessary to zfs to recognize a volume creation request, we use it as a condition to propose volume creation completions
# If -V is typed after -s or -b, zfs should accept it, but fish won't propose -s or -b, but, as these options are for volumes only, it seems reasonable to expect the user to ask for a volume, with -V, before giving its characteristics with -s or -b
complete-c zfs -x-n'__fish_zfs_using_command create'-s V -d'Volume size'
complete-c zfs -f-n'__fish_zfs_using_command create; and __fish_contains_opt -s V'-s s -d'Create a sparse volume'
complete-c zfs -x-n'__fish_zfs_using_command create; and __fish_contains_opt -s V'-s b -d'Blocksize'
# destroy completions; as the dataset is the last item, we can't know yet if it's a snapshot, a bookmark or something else, so we can't separate snapshot-specific options from others
complete-c zfs -f-n'__fish_zfs_using_command destroy'-s r -d'Recursively destroy children'
complete-c zfs -f-n'__fish_zfs_using_command destroy'-s R -d'Recursively destroy all dependents'
complete-c zfs -f-n'__fish_zfs_using_command destroy'-s f -d'Force unmounting'
complete-c zfs -f-n'__fish_zfs_using_command destroy'-s n -d'Dry run'
complete-c zfs -f-n'__fish_zfs_using_command destroy'-s p -d'Print machine-parsable verbose information'
complete-c zfs -f-n'__fish_zfs_using_command destroy'-s v -d'Verbose mode'
complete-c zfs -f-n'__fish_zfs_using_command destroy'-s d -d'Defer snapshot deletion'
complete-c zfs -x-n'__fish_zfs_using_command destroy'-d'Dataset to destroy'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots; __fish_print_zfs_bookmarks)'
# snapshot completions
complete-c zfs -f-n'__fish_zfs_using_command snapshot; or __fish_zfs_using_command snap'-s r -d'Recursively snapshot children'
iftest$OS='Linux'# Only Linux supports the comma-separated format; others need multiple -o calls
complete-c zfs -x-n'__fish_zfs_using_command snapshot; or __fish_zfs_using_command snap'-s o -d'Snapshot property'-a'(__fish_zfs_append (__fish_complete_zfs_rw_properties; __fish_complete_zfs_write_once_properties))'
else
complete-c zfs -x-n'__fish_zfs_using_command snapshot; or __fish_zfs_using_command snap'-s o -d'Snapshot property'-a'(__fish_complete_zfs_rw_properties; __fish_complete_zfs_write_once_properties)'
end
complete-c zfs -x-n'__fish_zfs_using_command snapshot; or __fish_zfs_using_command snap'-d'Dataset to snapshot'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes)'
# rollback completions
complete-c zfs -f-n'__fish_zfs_using_command rollback'-s r -d'Destroy later snapshot and bookmarks'
complete-c zfs -f-n'__fish_zfs_using_command rollback'-s R -d'Recursively destroy later snapshot, bookmarks and clones'
complete-c zfs -f-n'__fish_zfs_using_command rollback; and __fish_contains_opt -s R'-s f -d'Force unmounting of clones'
complete-c zfs -x-n'__fish_zfs_using_command rollback'-d'Snapshot to roll back to'-a'(__fish_print_zfs_snapshots)'
# clone completions
complete-c zfs -f-n'__fish_zfs_using_command clone'-s p -d'Create all needed non-existing parent datasets'
iftest$OS='Linux'# Only Linux supports the comma-separated format; others need multiple -o calls
complete-c zfs -x-n'__fish_zfs_using_command clone'-s o -d'Clone property'-a'(__fish_zfs_append (__fish_complete_zfs_rw_properties; __fish_complete_zfs_write_once_properties))'
else
complete-c zfs -x-n'__fish_zfs_using_command clone'-s o -d'Clone property'-a'(__fish_complete_zfs_rw_properties; __fish_complete_zfs_write_once_properties)'
end
complete-c zfs -x-n'__fish_zfs_using_command clone'-d'Snapshot to clone'-a'(__fish_print_zfs_snapshots)'
# promote completions
complete-c zfs -x-n'__fish_zfs_using_command promote'-d'Clone to promote'-a'(__fish_print_zfs_filesystems)'
# rename completions; as the dataset is the last item, we can't know yet if it's a snapshot or not, we can't separate snapshot-specific option from others
complete-c zfs -f-n'__fish_zfs_using_command rename'-s p -d'Create all needed non-existing parent datasets'
complete-c zfs -f-n'__fish_zfs_using_command rename'-s r -d'Recursively rename children snapshots'
iftest$OS='Linux'
complete-c zfs -f-n'__fish_zfs_using_command rename'-s f -d'Force unmounting if needed'
elseiftest$OS='FreeBSD'
complete-c zfs -f-n'__fish_zfs_using_command rename'-s u -d'Do not remount filesystems during rename'
complete-c zfs -f-n'__fish_zfs_using_command rename; and __fish_not_contain_opt -s u'-s f -d'Force unmounting if needed'
end
complete-c zfs -x-n'__fish_zfs_using_command rename'-d'Dataset to rename'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots)'
# list completions
complete-c zfs -f-n'__fish_zfs_using_command list'-s H -d'Print output in a machine-parsable format'
complete-c zfs -f-n'__fish_zfs_using_command list'-s r -d'Operate recursively on datasets'
complete-c zfs -x-n'__fish_zfs_using_command list; and __fish_contains_opt -s r'-s d -d'Maximum recursion depth'
complete-c zfs -f-n'__fish_zfs_using_command list'-s p -d'Print parsable (exact) values for numbers'
complete-c zfs -x-n'__fish_zfs_using_command list; and __fish_not_contain_opt -s S'-s s -d'Property to use for sorting output by ascending order'-a'(__fish_complete_zfs_rw_properties; __fish_complete_zfs_write_once_properties; __fish_complete_zfs_ro_properties; echo -e "name\t"(_ "Dataset name"))'
complete-c zfs -x-n'__fish_zfs_using_command list; and __fish_not_contain_opt -s s'-s S -d'Property to use for sorting output by descending order'-a'(__fish_complete_zfs_rw_properties; __fish_complete_zfs_write_once_properties; __fish_complete_zfs_ro_properties; echo -e "name\t"(_ "Dataset name"))'
complete-c zfs -x-n'__fish_zfs_using_command list'-s t -d'Dataset type'-a'(__fish_zfs_list_dataset_types)'
complete-c zfs -x-n'__fish_zfs_using_command list'-d'Dataset which properties is to be listed'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots)'
# set completions
complete-c zfs -x-n'__fish_zfs_using_command set'-d'Property to set'-a'(__fish_complete_zfs_rw_properties)'
complete-c zfs -x-n'__fish_zfs_using_command set; and string match -q -r "zfs set \S+ " (commandline -c)'-d'Dataset which property is to be setted'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots)'
# get completions
complete-c zfs -f-n'__fish_zfs_using_command get'-s r -d'Operate recursively on datasets'
complete-c zfs -x-n'__fish_zfs_using_command get; and __fish_contains_opt -s r'-s d -d'Maximum recursion depth'
complete-c zfs -f-n'__fish_zfs_using_command get'-s H -d'Print output in a machine-parsable format'
complete-c zfs -x-n'__fish_zfs_using_command get'-s o -d'Fields to display'-a'(__fish_zfs_append (__fish_zfs_list_get_fields))'
complete-c zfs -x-n'__fish_zfs_using_command get'-s s -d'Property source to display'-a'(__fish_zfs_append (__fish_zfs_list_source_types))'
complete-c zfs -f-n'__fish_zfs_using_command get'-s p -d'Print parsable (exact) values for numbers'
complete-c zfs -x-n'__fish_zfs_using_command get'-s t -d'Dataset type'-a'(__fish_zfs_append (__fish_zfs_list_dataset_types))'
complete-c zfs -x-n'__fish_zfs_using_command get'-d'Dataset which properties is to be got'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots)'
# inherit completions
complete-c zfs -f-n'__fish_zfs_using_command inherit'-s r -d'Operate recursively on datasets'
complete-c zfs -f-n'__fish_zfs_using_command inherit'-s S -d'Revert to the received value if available'
complete-c zfs -x-n'__fish_zfs_using_command inherit'-d'Dataset which properties is to be inherited'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots)'
# upgrade completions
complete-c zfs -f-n'__fish_zfs_using_command upgrade; and __fish_not_contain_opt -s a -s r -s V'-s v -d'Verbose mode'
complete-c zfs -f-n'__fish_zfs_using_command upgrade; and __fish_not_contain_opt -s v'-s a -d'Upgrade all eligible filesystems'
complete-c zfs -f-n'__fish_zfs_using_command upgrade; and __fish_not_contain_opt -s v'-s r -d'Operate recursively on datasets'
complete-c zfs -x-n'__fish_zfs_using_command upgrade; and __fish_not_contain_opt -s v'-s V -d'Upgrade to the specified version'
complete-c zfs -x-n'__fish_zfs_using_command upgrade; and __fish_not_contain_opt -s a'-d'Filesystem to upgrade'-a'(__fish_print_zfs_filesystems)'
# userspace/groupspace completions
complete-c zfs -f-n'__fish_zfs_using_command userspace'-s n -d'Print UID instead of user name'
complete-c zfs -f-n'__fish_zfs_using_command groupspace'-s n -d'Print GID instead of group name'
complete-c zfs -f-n'__fish_zfs_using_command userspace; or __fish_zfs_using_command groupspace'-s H -d'Print output in a machine-parsable format'
complete-c zfs -f-n'__fish_zfs_using_command userspace; or __fish_zfs_using_command groupspace'-s p -d'Print parsable (exact) values for numbers'
complete-c zfs -x-n'__fish_zfs_using_command userspace; or __fish_zfs_using_command groupspace'-s o -d'Field to display'-a'(__fish_zfs_append (__fish_zfs_list_space_fields))'
complete-c zfs -x-n'__fish_zfs_using_command userspace; or __fish_zfs_using_command groupspace; and __fish_not_contain_opt -s S'-s s -d'Property to use for sorting output by ascending order'-a'__fish_zfs_list_space_fields'
complete-c zfs -x-n'__fish_zfs_using_command userspace; or __fish_zfs_using_command groupspace; and __fish_not_contain_opt -s s'-s S -d'Property to use for sorting output by descending order'-a'__fish_zfs_list_space_fields'
complete-c zfs -x-n'__fish_zfs_using_command userspace'-s t -d'Identity types to display'-a'(__fish_zfs_append (__fish_zfs_list_userspace_types))'
complete-c zfs -x-n'__fish_zfs_using_command groupspace'-s t -d'Identity types to display'-a'(__fish_zfs_append (__fish_zfs_list_groupspace_types))'
complete-c zfs -f-n'__fish_zfs_using_command userspace; or __fish_zfs_using_command groupspace'-s i -d'Translate S(amba)ID to POSIX ID'
complete-c zfs -x-n'__fish_zfs_using_command userspace; or __fish_zfs_using_command groupspace'-d'Dataset which space usage is to be got'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_snapshots)'
# mount completions
complete-c zfs -x-n'__fish_zfs_using_command mount'-s o -d'Temporary mount point property'-a'(__fish_zfs_append (__fish_complete_zfs_mountpoint_properties))'
complete-c zfs -f-n'__fish_zfs_using_command mount'-s v -d'Report progress'
complete-c zfs -f-n'__fish_zfs_using_command mount'-s a -d'Mount all available ZFS filesystems'
ifcontains-- $OS Linux SunOS
complete-c zfs -f-n'__fish_zfs_using_command mount'-s O -d'Overlay mount'
end
complete-c zfs -x-n'__fish_zfs_using_command mount; and __fish_not_contain_opt -s a'-d'Filesystem to mount'-a'(__fish_print_zfs_filesystems)'
# unmount completions
complete-c zfs -f-n'__fish_zfs_using_command unmount; or __fish_zfs_using_command umount'-s f -d'Force unmounting if needed'
complete-c zfs -f-n'__fish_zfs_using_command unmount; or __fish_zfs_using_command umount'-s a -d'Unmount all available ZFS filesystems'
complete-c zfs -x-n'__fish_zfs_using_command unmount; or __fish_zfs_using_command umount; and __fish_not_contain_opt -s a'-d'Filesystem to unmount'-a'(__fish_print_zfs_filesystems; __fish_print_mounted)'
# share completions
complete-c zfs -f-n'__fish_zfs_using_command share'-s a -d'Share all eligible ZFS filesystems'
complete-c zfs -x-n'__fish_zfs_using_command share; and __fish_not_contain_opt -s a'-d'Filesystem to share'-a'(__fish_print_zfs_filesystems)'
# unshare completions
complete-c zfs -f-n'__fish_zfs_using_command unshare'-s a -d'Unshare all shared ZFS filesystems'
complete-c zfs -x-n'__fish_zfs_using_command unshare; and __fish_not_contain_opt -s a'-d'Filesystem to unshare'-a'(__fish_print_zfs_filesystems; __fish_print_mounted)'
# bookmark completions
if __fish_is_zfs_feature_enabled 'feature@bookmarks'
complete-c zfs -x-n'__fish_zfs_using_command bookmark'-d'Snapshot to bookmark'-a'(__fish_print_zfs_snapshots)'
end
# send completions
complete-c zfs -x-n'__fish_zfs_using_command send'-s i -d'Generate incremental stream from snapshot'-a'(__fish_print_zfs_snapshots; __fish_print_zfs_bookmarks)'
complete-c zfs -x-n'__fish_zfs_using_command send'-s I -d'Generate incremental stream from snapshot, even with intermediary snapshots'-a'(__fish_print_zfs_snapshots)'
iftest$OS='SunOS'
complete-c zfs -f-n'__fish_zfs_using_command send'-s R -l replicate -d'Include children in replication stream'
complete-c zfs -f-n'__fish_zfs_using_command send'-s D -l dedup -d'Generate a deduplicated stream'
complete-c zfs -f-n'__fish_zfs_using_command send; and __fish_is_zfs_feature_enabled "feature@large_blocks"'-s L -l large-block -d'Allow the presence of larger blocks than 128kiB'
complete-c zfs -f-n'__fish_zfs_using_command send; and __fish_is_zfs_feature_enabled "feature@embedded_data"'-s e -l embed -d'Generate a more compact stream by using WRITE_EMBEDDED records'
complete-c zfs -f-n'__fish_zfs_using_command send'-s P -l parsable -d'Print verbose information about the stream in a machine-parsable format'
complete-c zfs -f-n'__fish_zfs_using_command send'-s c -l compressed -d'Generate compressed stream'
complete-c zfs -f-n'__fish_zfs_using_command send'-s n -l dryrun -d'Dry run'
complete-c zfs -f-n'__fish_zfs_using_command send; and __fish_not_contain_opt -s R'-s p -l props -d'Include dataset properties'
complete-c zfs -f-n'__fish_zfs_using_command send'-s v -l verbose -d'Print verbose information about the stream'
else
complete-c zfs -f-n'__fish_zfs_using_command send'-s R -d'Include children in replication stream'
complete-c zfs -f-n'__fish_zfs_using_command send'-s D -d'Generate a deduplicated stream'
complete-c zfs -f-n'__fish_zfs_using_command send; and __fish_is_zfs_feature_enabled "feature@large_blocks"'-s L -d'Allow the presence of larger blocks than 128kiB'
complete-c zfs -f-n'__fish_zfs_using_command send; and __fish_is_zfs_feature_enabled "feature@embedded_data"'-s e -d'Generate a more compact stream by using WRITE_EMBEDDED records'
complete-c zfs -f-n'__fish_zfs_using_command send'-s P -d'Print verbose information about the stream in a machine-parsable format'
complete-c zfs -f-n'__fish_zfs_using_command send'-s n -d'Dry run'
complete-c zfs -f-n'__fish_zfs_using_command send; and __fish_not_contain_opt -s R'-s p -d'Include dataset properties'
complete-c zfs -f-n'__fish_zfs_using_command send'-s v -d'Print verbose information about the stream'
end
complete-c zfs -x-n'__fish_zfs_using_command send'-d'Dataset to send'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots)'
# receive completions
complete-c zfs -f-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv'-s v -d'Print verbose information about the stream and the time spent processing it'
complete-c zfs -f-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv'-s n -d'Dry run: do not actually receive the stream'
complete-c zfs -f-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv'-s F -d'Force rollback to the most recent snapshot'
complete-c zfs -f-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv'-s u -d'Unmount the target filesystem'
complete-c zfs -f-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv; and __fish_not_contain_opt -s e'-s d -d'Discard the first element of the path of the sent snapshot'
complete-c zfs -f-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv; and __fish_not_contain_opt -s d'-s e -d'Discard all but the last element of the path of the sent snapshot'
iftest$OS="SunOS"
complete-c zfs -x-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv'-s o -d'Force the stream to be received as a clone of the given snapshot'-a'origin'
end
if __fish_is_zfs_feature_enabled "feature@extensible_dataset"
complete-c zfs -f-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv'-s s -d'On transfer interruption, store a receive_resume_token for resumption'
end
complete-c zfs -x-n'__fish_zfs_using_command receive; or __fish_zfs_using_command recv'-d'Dataset to receive'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots)'
# allow completions
complete-c zfs -f-n'__fish_zfs_using_command allow; and __fish_not_contain_opt -s d'-s l -d'Delegate permissions only on the specified dataset'
complete-c zfs -f-n'__fish_zfs_using_command allow; and __fish_not_contain_opt -s l'-s d -d'Delegate permissions only on the descendents dataset'
complete-c zfs -x-n'__fish_zfs_using_command allow; and __fish_not_contain_opt -s e'-s u -d'User to delegate permissions to'-a'(__fish_zfs_append (__fish_complete_users))'
complete-c zfs -x-n'__fish_zfs_using_command allow; and __fish_not_contain_opt -s e'-s g -d'Group to delegate permissions to'-a'(__fish_zfs_append (__fish_complete_groups))'
ifcontains-- $OS SunOS FreeBSD
complete-c zfs -f-n'__fish_zfs_using_command allow; and __fish_not_contain_opt -s u -s g -s e'-a'everyone'-d'Delegate permission to everyone'
end
complete-c zfs -x-n'__fish_zfs_using_command allow; and __fish_not_contain_opt -s u -s g everyone'-s e -d'Delegate permission to everyone'
complete-c zfs -x-n'__fish_zfs_using_command allow; and __fish_not_contain_opt -s l -s d -s e -s g -s u -s s'-s c -d'Delegate permissions only to the creator of later descendent datasets'-a'(__fish_zfs_append (__fish_zfs_list_permissions))'
complete-c zfs -x-n'__fish_zfs_using_command allow; and __fish_not_contain_opt -s l -s d -s e -s g -s u -s c'-s s -d'Create a permission set or add permissions to an existing one'
complete-c zfs -x-n'__fish_zfs_using_command allow'-d'Dataset on which delegation is to be applied'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes)'
# unallow completions
complete-c zfs -f-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s d'-s l -d'Remove permissions only on the specified dataset'
complete-c zfs -f-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s l'-s d -d'Remove permissions only on the descendents dataset'
complete-c zfs -x-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s e'-s u -d'User to remove permissions from'-a'(__fish_zfs_append (__fish_complete_users))'
complete-c zfs -x-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s e'-s g -d'Group to remove permissions from'-a'(__fish_zfs_append (__fish_complete_groups))'
complete-c zfs -x-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s u -s g everyone'-s e -d'Remove permission from everyone'
complete-c zfs -x-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s l -s d -s e -s g -s u -s s'-s c -d'Remove permissions only on later created descendent datasets'-a'(__fish_zfs_append (__fish_zfs_list_permissions))'
complete-c zfs -x-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s l -s d -s e -s g -s u -s c'-s s -d'Remove a permission set or remove permissions from an existing one'
iftest$OS='SunOS'
complete-c zfs -f-n'__fish_zfs_using_command unallow'-s r -d'Remove permissions recursively'
complete-c zfs -f-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s u -s g -s e'-a'everyone'-d'Remove permission from everyone'
elseiftest$OS='FreeBSD'
complete-c zfs -f-n'__fish_zfs_using_command unallow; and __fish_not_contain_opt -s u -s g -s e'-a'everyone'-d'Remove permission from everyone'
end
complete-c zfs -x-n'__fish_zfs_using_command unallow'-d'Dataset on which delegation is to be removed'-a'(__fish_print_zfs_filesystems; __fish_print_zfs_volumes)'
# hold completions
complete-c zfs -f-n'__fish_zfs_using_command hold'-s r -d'Apply hold recursively'
complete-c zfs -x-n'__fish_zfs_using_command hold'-d'Snapshot on which hold is to be applied'-a'(__fish_print_zfs_snapshots)'
# holds completions
complete-c zfs -f-n'__fish_zfs_using_command holds'-s r -d'List holds recursively'
complete-c zfs -x-n'__fish_zfs_using_command holds'-d'Snapshot which holds are to be listed'-a'(__fish_print_zfs_snapshots)'
# release completions
complete-c zfs -f-n'__fish_zfs_using_command release'-s r -d'Release hold recursively'
complete-c zfs -x-n'__fish_zfs_using_command release'-d'Snapshot from which hold is to be removed'-a'(__fish_print_zfs_snapshots)'
# diff completions
complete-c zfs -f-n'__fish_zfs_using_command diff'-s F -d'Display file type (à la ls -F)'
complete-c zfs -f-n'__fish_zfs_using_command diff'-s H -d'Print output in a machine-parsable format'
complete-c zfs -f-n'__fish_zfs_using_command diff'-s t -d'Display inode change time'
complete-c zfs -x-n'__fish_zfs_using_command diff'-d'Source snapshot for the diff'-a'(__fish_print_zfs_snapshots)'
# program completions
iftest$OS='SunOS'# This is currently only supported under Illumos, but that will probably change
complete-c zfs -x-n'__fish_zfs_using_command program'-s t -d'Execution timeout'
complete-c zfs -x-n'__fish_zfs_using_command program'-s t -d'Execution memory limit'
complete-c zfs -x-n'__fish_zfs_using_command program'-d'Pool which program will be executed on'-a'(__fish_complete_zfs_pools)'