Created
June 20, 2016 13:30
-
-
Save Nephos/f5a1b4131adcefdf30bc0cba5a1a1078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
complete -c crystal -n '__fish_crystal_no_subcmd' -fa compile -d "compile the specified file" | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa run -d "run the specified file as a program" | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa spec -d "run the unit test in ./spec" | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa docs -d "generate the documentation" | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa deps -d "install the dependencies" | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa env | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa eval | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa play | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa tool | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa help -d "display the help screen" | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa version -d "display the current crystal version" | |
complete -c crystal -n '__fish_crystal_no_subcmd' -fa init -d "initiatize a new repository" | |
complete -c crystal -n '__fish_crystal_with_no_file' -a "(ls * -d)" | |
complete -c crystal -n '__fish_crystal_no_subcmd' | |
function __fish_crystal_with_no_file --description 'Test if crystal can have a file as parameter' | |
for i in (commandline -opc) | |
if contains -- $i spec docs deps help version | |
return 1 | |
end | |
end | |
for i in (commandline -opc) | |
if contains -- $i compile run | |
return 0 | |
end | |
end | |
return 1 | |
end | |
function __fish_crystal_no_subcmd --description 'Test if crystal already has a command' | |
for i in (commandline -opc) | |
if contains -- $i compile run spec docs deps env eval play tool help version init | |
return 1 | |
end | |
end | |
return 0 | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment