aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions
diff options
context:
space:
mode:
authorGravatar Terje Larsen <terlar@gmail.com>2013-05-26 01:41:33 +0200
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-06-02 00:27:07 -0700
commit599556d7d1fde64d841f14524ce2c60b629800f0 (patch)
treea0ed7e23a96829e61f79faeddbadb2550ce42317 /share/completions
parent9e4d7b41e007982217d84aa8e787f1901e0342a8 (diff)
Add completions for lunchy (Service launcher for OSX)
Now when we have fuzzy matching it is actually quite useful.
Diffstat (limited to 'share/completions')
-rw-r--r--share/completions/lunchy.fish47
1 files changed, 47 insertions, 0 deletions
diff --git a/share/completions/lunchy.fish b/share/completions/lunchy.fish
new file mode 100644
index 00000000..ea1538b6
--- /dev/null
+++ b/share/completions/lunchy.fish
@@ -0,0 +1,47 @@
+function __fish_lunchy_needs_command
+ set cmd (commandline -opc)
+
+ if test (count $cmd) -eq 1
+ return 0
+ end
+
+ return 1
+end
+
+function __fish_lunchy_using_command
+ set cmd (commandline -opc)
+ set cmd_count (count $cmd)
+
+ if test $cmd_count -lt 2
+ return 1
+ end
+
+ for arg in $argv
+ if test $arg = $cmd[2]
+ return 0
+ end
+ end
+
+ return 1
+end
+
+complete -f -c lunchy -s v -l verbose -d 'Show command executions'
+
+# Commands
+complete -f -c lunchy -n '__fish_lunchy_needs_command' -a install -d 'Installs [file] to ~/Library/LaunchAgents or /Library/LaunchAgents'
+complete -f -c lunchy -n '__fish_lunchy_needs_command' -a 'ls list' -d 'Show the list of installed agents'
+complete -f -c lunchy -n '__fish_lunchy_needs_command' -a start -d 'Start the first matching agent'
+complete -f -c lunchy -n '__fish_lunchy_needs_command' -a stop -d 'Stop the first matching agent'
+complete -f -c lunchy -n '__fish_lunchy_needs_command' -a restart -d 'Stop and start the first matching agent'
+complete -f -c lunchy -n '__fish_lunchy_needs_command' -a status -d 'Show the PID and label for all agents'
+complete -f -c lunchy -n '__fish_lunchy_needs_command' -a edit -d 'Opens the launchctl daemon file in the default editor'
+
+# Commands with service completion
+complete -f -c lunchy -n '__fish_lunchy_using_command ls list start stop restart status edit' -a '(lunchy ls)' -d 'Service'
+
+# Command: start
+complete -f -c lunchy -n '__fish_lunchy_using_command start' -s w -l write -d 'Persist command'
+complete -f -c lunchy -n '__fish_lunchy_using_command start' -s F -l force -d 'Force start (disabled) agents'
+
+# Command: stop
+complete -f -c lunchy -n '__fish_lunchy_using_command stop' -s w -l write -d 'Persist command'