Move ninja functions into ninja completions

Part of #5279

[ci skip]
This commit is contained in:
Fabian Homborg 2019-03-15 19:53:20 +01:00
parent 1c3c76165e
commit 2de3f7c686
3 changed files with 12 additions and 11 deletions

View file

@ -1,3 +1,15 @@
function __fish_print_ninja_tools
echo list
if test -f build.ninja
ninja -t list | string match -v '*:' | string replace -r '\s+(\w+).*' '$1'
end
end
function __fish_print_ninja_targets
if test -f build.ninja
ninja -t targets 2>/dev/null | string replace -r ':.*' ''
end
end
complete -c ninja -f -a '(__fish_print_ninja_targets)' -d target
complete -x -c ninja -s t -x -a "(__fish_print_ninja_tools)" -d subtool
complete -x -c ninja -s C -x -a "(__fish_complete_directories (commandline -ct))" -d "change to specified directory"

View file

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

View file

@ -1,6 +0,0 @@
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