fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a9618477e
master
1function __fish_lunchy_needs_command 2set -l cmd( commandline -xpc) 3 4if test ( count $cmd ) -eq 1 5return 0 6end 7 8return 1 9end 10 11function __fish_lunchy_using_command 12set -l cmd( commandline -xpc) 13set -l cmd_count( count $cmd ) 14 15if test $cmd_count -lt 2 16return 1 17end 18 19for argin $argv 20if test $arg = $cmd [ 2 ] 21return 0 22end 23end 24 25return 1 26end 27 28complete -f -c lunchy -s v -l verbose -d'Show command executions' 29 30# Commands 31complete -f -c lunchy -n __fish_lunchy_needs_command -a install -d'Installs [file] to ~/Library/LaunchAgents or /Library/LaunchAgents' 32complete -f -c lunchy -n __fish_lunchy_needs_command -a'ls list' -d'Show the list of installed agents' 33complete -f -c lunchy -n __fish_lunchy_needs_command -a start -d'Start the first matching agent' 34complete -f -c lunchy -n __fish_lunchy_needs_command -a stop -d'Stop the first matching agent' 35complete -f -c lunchy -n __fish_lunchy_needs_command -a restart -d'Stop and start the first matching agent' 36complete -f -c lunchy -n __fish_lunchy_needs_command -a status -d'Show the PID and label for all agents' 37complete -f -c lunchy -n __fish_lunchy_needs_command -a edit -d'Opens the launchctl daemon file in the default editor' 38 39# Commands with service completion 40complete -f -c lunchy -n'__fish_lunchy_using_command ls list start stop restart status edit' -a'(lunchy ls)' -d Service 41 42# Command: start 43complete -f -c lunchy -n'__fish_lunchy_using_command start' -s w -l write -d'Persist command' 44complete -f -c lunchy -n'__fish_lunchy_using_command start' -s F -l force -d'Force start (disabled) agents' 45 46# Command: stop 47complete -f -c lunchy -n'__fish_lunchy_using_command stop' -s w -l write -d'Persist command'