Add completions for ninja build system

This commit is contained in:
Branislav Šott 2016-09-28 00:17:24 +02:00 committed by Fabian Homborg
parent d2739f10e1
commit 61388cff02
3 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,10 @@
complete -c ninja -f -a '(__fish_print_ninja_targets)' -d Target
complete -x -c ninja -s t -x -a "(__fish_print_ninja_tools)" -d Tools
complete -x -c ninja -s C -x -a "(__fish_complete_directories (commandline -ct))" -d "Change to DIR"
complete -c ninja -s f -x -d "specify build file"
complete -f -c ninja -s n -d "dry run"
complete -f -c ninja -s v -d "show all command lines while building"
complete -f -c ninja -s j -d "number of jobs"
complete -f -c ninja -s l -d "do not start if load > N"
complete -f -c ninja -s k -d "keep until N jobs fail"
complete -f -c ninja -s h -d "help"

View File

@ -0,0 +1,5 @@
function __fish_print_ninja_targets
if [ -f build.ninja ]
ninja -t targets 2> /dev/null | string replace -r ':.*' ''
end
end

View File

@ -0,0 +1,6 @@
function __fish_print_ninja_tools
echo list
if [ -f build.ninja ]
ninja -t list | string match -v '*:' | string replace -r '\s+(\w+).*' '$1'
end
end