Last active
August 29, 2015 14:06
-
-
Save snit-ram/4915c4894be837c38be7 to your computer and use it in GitHub Desktop.
Fish grunt completion
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
# Completion for grunt | |
# Modified version by snit | |
# place this file at ~/.config/fish/completions/grunt.fish | |
# grunt-cli | |
# http://gruntjs.com/ | |
# | |
# Copyright (c) 2012 Tyler Kellen, contributors | |
# Licensed under the MIT license. | |
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT | |
function __grunt_print_tasks | |
set gruntfile_hash (md5sum Gruntfile.js 2>/dev/null | cut -d " " -f 1) | |
set -l tasks (cat 2>/dev/null ._grunt_fish_complete_$gruntfile_hash) | |
if test (count $tasks) -eq 0 | |
rm ._grunt_fish_complete_* | |
grunt --version --verbose ^/dev/null | awk '/Available tasks: / {$3=$2=$1=""; print $0}' | awk '{$1=$1}1' | tr ' ' '\n' > ._grunt_fish_complete_$gruntfile_hash | |
set -l tasks (cat 2>/dev/null ._grunt_fish_complete_$gruntfile_hash) | |
end | |
for t in $tasks | |
echo $t | |
end | |
end | |
complete -c grunt -fa '(__grunt_print_tasks)' | |
complete -c grunt -s h -l help -d "Display help text" | |
complete -c grunt -l base -d "Specify an alternate base path" | |
complete -c grunt -l no-color -d "Disable colored output" | |
complete -c grunt -l gruntfile -rd "Specify an alternate Gruntfile" | |
complete -c grunt -s d -l debug -d "Enable debugging mode for tasks that support it" | |
complete -c grunt -l stack -d "Print a stack trace when exiting with a warning or fatal error" | |
complete -c grunt -s f -l force -d "A way to force your way past warnings." | |
complete -c grunt -l tasks -rd "Additional directory paths to scan for task and "extra" files" | |
complete -c grunt -l npm -x -d "Npm-installed grunt plugins to scan for task and "extra" files" | |
complete -c grunt -l no-write -d "Disable writing files (dry run)" | |
complete -c grunt -s v -l verbose -d "Verbose mode. A lot more information output" | |
complete -c grunt -s V -l version -d "Print the grunt version. Combine with --verbose for more info" | |
complete -c grunt -l completion -d "Output shell auto-completion rules." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment