aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_complete_path.fish
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2014-09-28 16:35:14 +0800
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2014-09-29 14:05:18 +0800
commit6ece8523b112871f49afc374c7bbe8aeaa3dc047 (patch)
treed17c39ec79b6ec9151f57ace0e2657b496e3b0d3 /share/functions/__fish_complete_path.fish
parent84af3dcd18227d343070c1df4112155ef9207526 (diff)
__fish_complete_path: add new completion, mimics builtin path completion
Completions can now be written which disable file completion and then selectively re-enable it using this function. Closes #834.
Diffstat (limited to 'share/functions/__fish_complete_path.fish')
-rw-r--r--share/functions/__fish_complete_path.fish14
1 files changed, 14 insertions, 0 deletions
diff --git a/share/functions/__fish_complete_path.fish b/share/functions/__fish_complete_path.fish
new file mode 100644
index 00000000..e10ef706
--- /dev/null
+++ b/share/functions/__fish_complete_path.fish
@@ -0,0 +1,14 @@
+function __fish_complete_path --description "Complete using path"
+ set -l target
+ set -l description
+ switch (count $argv)
+ case 0
+ # pass
+ case 1
+ set target "$argv[1]"
+ case 2 "*"
+ set target "$argv[1]"
+ set description "$argv[2]"
+ end
+ printf "%s\t$description\n" (command ls -dp "$target"*)
+end