facebook / buck2

Build system, successor to Buck
https://buck2.build/
Apache License 2.0
3.58k stars 221 forks source link

Tab completion for targets when on the command line #169

Open thoughtpolice opened 1 year ago

thoughtpolice commented 1 year ago

It would be awesome if buck2 could, on the command line, auto-complete the name of a target given a target pattern prefix such as path/to/module: (completing any target in the BUCK file) or path/to/library:foo (anything with a name prefix of foo). I often find myself wanting this.

I am not sure how much "work" is necessary to resolve all the names in 100% of cases, but it seems like a in theory BUCK files can be parsed for their target outputs without actually constructing the action graph, right? If you can just iterate every name field on every rule in the file, that's probably a good start.

ndmitchell commented 1 year ago

Completely agreed! I would imagine you want to race parsing the Starlark file for name = ... entries and actually run the Starlark code in the equivalent of buck2 targets, and if after 0.5s you don't have the real stuff, you use the Starlark file data. We've had this as an internal request for some time, often being a "nice to have", but never becoming a "we'll do it now". Volunteers most welcome.

davidbarsky commented 1 year ago

For what it's worth, I think this might be blocked on https://github.com/clap-rs/clap/issues/1232.

rzig commented 2 months ago

It looks like as of 3 weeks ago clap might support this now. I could try to put something together?