aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions
diff options
context:
space:
mode:
Diffstat (limited to 'share/functions')
-rw-r--r--share/functions/__fish_complete_blockdevice.fish12
1 files changed, 12 insertions, 0 deletions
diff --git a/share/functions/__fish_complete_blockdevice.fish b/share/functions/__fish_complete_blockdevice.fish
new file mode 100644
index 00000000..d07487de
--- /dev/null
+++ b/share/functions/__fish_complete_blockdevice.fish
@@ -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