wide-midnight-78598
09/26/2022, 7:39 PM./pants completions
- even if it's contrived, I like the idea of something like ./pants --completions
which kinda indicates that it's acting on the pants instance itself, rather than being a verb for some other work
2. What should the output of said pseudo-goal be? Print the completions to the console? Export to dist
? This is probably a per-repo file, since it depends on what the installed backend packages are - so it may not be something trivially exported to a completions folder somewhere on the user's filesystem
3. Can this be auto-updated if the backend-packages change?hundreds-father-404
09/26/2022, 7:48 PMWhat should the output of said pseudo-goal be?Maybe depends if we want to output for all shells, vs only one?
Can this be auto-updated if the backend-packages change?Not currently. Relates a little to https://github.com/pantsbuild/pants/issues/12014 I think
proud-dentist-22844
09/26/2022, 8:23 PMcompletions
goal, then maybe people could configure (probably in ~/.pants.rc
) which shells they want: bash, zsh, …
Then, plugins could register additional shell types for that goal (with a union). But, shell completion backends would need to be enabled via ~/.pants.rc
so that people can use esoteric shells without forcing projects to add support in their pants.toml
And now, I’ve probably veered off into left field…
Using the top-level completions would also make it discoverable when people list the available goals../pants completions
goal, I can imagine a zsh completion plugin that calls that to add contextual completions on the fly.
For the zsh completion, I can imagine an oh-my-zsh plugin that would call ./pants completions test --
given the user typing ./pants test --<tab>
to get the valid args in that context.wide-midnight-78598
09/26/2022, 8:30 PM./pants completions
called on each ... keystroke?proud-dentist-22844
09/26/2022, 8:31 PM<tab>
to ask for completionswide-midnight-78598
09/26/2022, 8:32 PMproud-dentist-22844
09/26/2022, 8:33 PMwide-midnight-78598
09/26/2022, 8:34 PMproud-dentist-22844
09/26/2022, 8:34 PMwide-midnight-78598
09/26/2022, 8:37 PM./pants --version 0.64s user 0.10s system 26% cpu 2.817 total
That's for when there is a backend package mistake
This is on the example-python repo:
./pants --version 0.56s user 0.08s system 78% cpu 0.816 total
./pants completions 0.71s user 0.12s system 60% cpu 1.365 total