2017-11-23 12:55:59 +00:00
|
|
|
function __fish_print_zfs_snapshots -d "Lists ZFS snapshots"
|
2020-11-13 04:19:05 +00:00
|
|
|
set fast_results (zfs list -o name -H)
|
|
|
|
printf "%s\n" $fast_results
|
|
|
|
|
|
|
|
# Don't retrieve all snapshots for all datasets until an @ is specified,
|
|
|
|
# or if there is only one possible matching dataset. (See #7472)
|
|
|
|
set current_token (commandline --current-token)
|
|
|
|
set filtered_results (string match -e -- $current_token $fast_results)
|
|
|
|
if contains -- --force $argv ||
|
|
|
|
not set -q filtered_results[2] ||
|
|
|
|
string match -eq @ -- $current_token
|
|
|
|
|
|
|
|
zfs list -t snapshot -o name -H
|
|
|
|
end
|
2017-11-23 12:55:59 +00:00
|
|
|
end
|