feat(completion): dynamic process-name completion for run/up and process start/stop/restart#524
Open
ilyagr wants to merge 3 commits into
Open
feat(completion): dynamic process-name completion for run/up and process start/stop/restart#524ilyagr wants to merge 3 commits into
ilyagr wants to merge 3 commits into
Conversation
ilyagr
force-pushed
the
task-shell-completion
branch
3 times, most recently
from
July 24, 2026 05:30
3a2a790 to
e52c086
Compare
ilyagr
marked this pull request as ready for review
July 24, 2026 05:31
…ess start/stop/restart Add shell completion to process-name-taking commands such as `process-compose run <TAB>`. Uses cobra's `ValidArgsFunction` functionality. Should work in every supported shell. `run` and `up` load names from the config file, which also allows them to pass the first line of the process descriptions (if defined in the config) to `cobra` together with the names. The `process start/stop/restart` commands query the running server. The server doesn't currently return the process descriptions (this could be added relatively easily), so the completions will come without descriptions. On any error (missing config or unreachable server) the helpers return ShellCompDirectiveNoFileComp with no candidates. The config path sets IsInternalLoader so a malformed or half-edited config returns an error instead of aborting completion via log.Fatal.
One of `process-compose` CLI rules is that the `--unix-socket blah` flag implies `-U`. Because of the way this logic is implemented inside `PersistentPreRun`, it doesn't work in the completion execution flow for `completeProcessNamesFromServer`. Before this commit, tab completion would work correctly for either `process-compose -U --unix-socket blah process start <TAB>` or `PC_SOCKET_PATH=blah process-compose ...`, but it would surprisingly not work for just `process-compose --unix-socket blah ...`.
ilyagr
force-pushed
the
task-shell-completion
branch
from
July 24, 2026 05:44
e52c086 to
9a10107
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Add shell completion to process-name-taking commands such as
process-compose run <TAB>. Uses cobra'sValidArgsFunctionfunctionality. Should work in every supported shell.
runandupload names from the config file, which also allows themto pass the first line of the process descriptions (if defined in the
config) to
cobratogether with the names.The
process start/stop/restartcommands query the running server.The server doesn't currently return the process descriptions (this could
be added relatively easily), so the completions will come without
descriptions.
On any error (missing config or unreachable server) the helpers return
ShellCompDirectiveNoFileComp with no candidates. The config path sets
IsInternalLoader so a malformed or half-edited config returns an error
instead of aborting completion via log.Fatal.
About the third commit,
honor --unix-socket ...That is a preventive fix to a somewhat obscure but really confusing problem
discovered by AI. See the description and the code for details. It comes with
a somewhat heavy-weight AI-generated test to prove that the bug actually exists.
I'm happy to remove that commit if you prefer a different solution, or to
keep the fix and remove the heavy-weight (but IMO easy-to-follow) test.
One potentially better solution IMO would be to remove the
-Uflag entirely, I'm notsure it's useful when
--unix-socketimplies-Ubut a bare-Ucreatesa socket at a hard-to-guess path.