mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Split off __fish_complete_blockdevice from mount.fish.
The __fish_complete_blockdevice function can be useful to other completions than mount.fish, so it should live on its own so its available to those.
This commit is contained in:
parent
980fb59232
commit
7af9e1f5c5
2 changed files with 12 additions and 8 deletions
|
@ -1,12 +1,4 @@
|
|||
# Completions for mount
|
||||
function __fish_complete_blockdevice
|
||||
set -l cmd (commandline -ct)
|
||||
[ "" = "$cmd" ]; and return
|
||||
for f in $cmd*
|
||||
[ -b $f ]; and printf "%s\t%s\n" $f "Block device"
|
||||
[ -d $f ]; and printf "%s\n" $f/
|
||||
end
|
||||
end
|
||||
|
||||
complete -x -c mount -a '(__fish_complete_blockdevice)'
|
||||
# In case `mount UUID=` and similar also works
|
||||
|
|
12
share/functions/__fish_complete_blockdevice.fish
Normal file
12
share/functions/__fish_complete_blockdevice.fish
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Helper function for completions that need to enumerate block devices.
|
||||
function __fish_complete_blockdevice
|
||||
set -l cmd (commandline -ct)
|
||||
test "" = "$cmd"
|
||||
and return
|
||||
for f in $cmd*
|
||||
test -b $f
|
||||
and printf "%s\t%s\n" $f "Block device"
|
||||
test -d $f
|
||||
and printf "%s\n" $f/
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue