Update update_completions fish function for python argcomplete

When using register-python-argcomplete, the target command is the last arg rather than
the first. This will pull that value instead.
This commit is contained in:
ViViDboarder 2023-12-13 10:51:49 -08:00
parent 3fe2b6dac0
commit 3360c13414

View File

@ -14,6 +14,11 @@ function update_completions --description "Update completions for a command" --a
set --local completion_dir "$XDG_CONFIG_HOME" set --local completion_dir "$XDG_CONFIG_HOME"
end end
if [ "$target_command" = "register-python-argcomplete" ]
echo "Command was py $argv[-1]"
set target_command $argv[-1]
end
set --local completion_path "$completion_dir/$target_command.fish" set --local completion_path "$completion_dir/$target_command.fish"
eval $argv[1..] | tee "$completion_path" | source eval $argv[1..] | tee "$completion_path" | source
echo "Completions for $target_command generated, sourced, and stored in $completion_path for future shells" 1>&2 echo "Completions for $target_command generated, sourced, and stored in $completion_path for future shells" 1>&2