Show only writeable volumes

to exclude system volume
This commit is contained in:
Schlomo Schapiro 2024-06-18 12:16:34 +02:00 committed by Peter Ammon
parent f0c8f7406c
commit b3a16e0993
No known key found for this signature in database

View File

@ -14,6 +14,11 @@ function __fish_diskutil_mounted_volumes
printf '%s\n' $mountpoints
end
function __fish_diskutil_writeable_volumes
set -l mountpoints (path filter -w /Volumes/*)
printf '%s\n' $mountpoints
end
function __fish_diskutil_using_not_subcommand
not __fish_seen_subcommand_from apfs
and not __fish_seen_subcommand_from appleRAID
@ -53,7 +58,7 @@ complete -f -c diskutil -n '__fish_diskutil_using_not_subcommand umountDisk' -a
# eject
complete -f -c diskutil -n __fish_use_subcommand -a eject -d 'Eject a volume or disk'
complete -f -c diskutil -n '__fish_diskutil_using_not_subcommand eject' -a '(__fish_diskutil_mounted_volumes) (__fish_diskutil_devices)'
complete -f -c diskutil -n '__fish_diskutil_using_not_subcommand eject' -a '(__fish_diskutil_writeable_volumes ; __fish_diskutil_devices)'
# mount
complete -f -c diskutil -n __fish_use_subcommand -a mount -d 'Mount a single volume'