diff --git a/share/completions/ninja.fish b/share/completions/ninja.fish index 0dd0174bf..935d324bd 100644 --- a/share/completions/ninja.fish +++ b/share/completions/ninja.fish @@ -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" diff --git a/share/functions/__fish_print_ninja_targets.fish b/share/functions/__fish_print_ninja_targets.fish deleted file mode 100644 index 18d62fba6..000000000 --- a/share/functions/__fish_print_ninja_targets.fish +++ /dev/null @@ -1,5 +0,0 @@ -function __fish_print_ninja_targets - if [ -f build.ninja ] - ninja -t targets 2>/dev/null | string replace -r ':.*' '' - end -end diff --git a/share/functions/__fish_print_ninja_tools.fish b/share/functions/__fish_print_ninja_tools.fish deleted file mode 100644 index 385c91edc..000000000 --- a/share/functions/__fish_print_ninja_tools.fish +++ /dev/null @@ -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