carapace-sh / carapace-bin

multi-shell multi-command argument completer
https://carapace.sh
MIT License
767 stars 45 forks source link

make: support directory selection with '-C' #2370

Closed BatmanAoD closed 1 month ago

BatmanAoD commented 2 months ago

Current Behavior

make -C <dir> <tab> prints ERR _.

Expected Behavior

make -C <dir> selects the directory containing the Makefile. Standard bash-completion for make supports this, so if <dir> contains a Makefile with targets foo and bar, then make -C <dir> <tab> produces foo and bar as completions.

Steps To Reproduce

Create a Makefile with some targets. Move to a different directory. Type make -C <dir with makefile> and hit tab.

Version

1.0.1

OS

Shell

Anything else?

I found this pull request, but I'm not sure what it does. It does not provide special behavior for the -C flag.

rsteube commented 1 month ago

Yeah, seems I didn't test it. The PR is correct, but I left the code in the action, which breaks it as the folder is already changed at that time.

Oh, and -C is the shorthand for --directory, which is why the flag is calleddirectory in the code.