mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
make completions for ninja aware of the build directory passed by -C
This commit is contained in:
parent
9d1ccf8110
commit
4a1edbd3cb
1 changed files with 12 additions and 7 deletions
|
@ -1,14 +1,19 @@
|
||||||
|
function __fish_ninja
|
||||||
|
set -l saved_args $argv
|
||||||
|
set -l dir .
|
||||||
|
argparse -i C/dir= -- (commandline -opc)
|
||||||
|
and set -ql _flag_C
|
||||||
|
and set -l dir $_flag_C
|
||||||
|
test -f $dir/build.ninja
|
||||||
|
and command ninja -C$dir $saved_args
|
||||||
|
end
|
||||||
|
|
||||||
function __fish_print_ninja_tools
|
function __fish_print_ninja_tools
|
||||||
echo list
|
__fish_ninja -t list | string match -v '*:' | string replace -r '\s+(\w+).*' '$1'
|
||||||
if test -f build.ninja
|
|
||||||
ninja -t list | string match -v '*:' | string replace -r '\s+(\w+).*' '$1'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_print_ninja_targets
|
function __fish_print_ninja_targets
|
||||||
if test -f build.ninja
|
__fish_ninja -t targets 2>/dev/null | string replace -r ':.*' ''
|
||||||
ninja -t targets 2>/dev/null | string replace -r ':.*' ''
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
complete -c ninja -f -a '(__fish_print_ninja_targets)' -d target
|
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 t -x -a "(__fish_print_ninja_tools)" -d subtool
|
||||||
|
|
Loading…
Reference in a new issue