feat: dynamic shell completion, starting with bash - #1422
Open
cachelous wants to merge 18 commits into
Open
Conversation
Collaborator
|
Let me know if you want any help rebasing. Sorry for the conflicts, I'm done for a bit (was working on improving compile time performance). |
cachelous
force-pushed
the
feat/completion
branch
from
August 6, 2026 21:32
507ce9d to
a9ca845
Compare
cachelous
force-pushed
the
feat/completion
branch
5 times, most recently
from
August 7, 2026 08:08
a16b16f to
37c1234
Compare
cachelous
force-pushed
the
feat/completion
branch
from
August 7, 2026 08:18
0b86359 to
7cd2b38
Compare
- Guard the option group tests that use IsMember behind the extra validators macro. - Rename the locals and the parameter that shadow App's own name(), alias() and disabled(), which gcc 4.8 rejects under -Werror=shadow. - Strip a trailing carriage return from each reply line in the generated script: a program built for Windows writes CRLF, and the return only showed on a candidate that carries no description. - Drive the script with eval rather than source <(...), which reads nothing under the bash 3.2 that macOS ships. - Add the includes cpplint asks for, mark completion_test.sh executable so its shebang stops failing pre-commit, and take the cmake-format and module export ordering pre-commit asked for. - Reduce the scope of test argument vectors.
cachelous
force-pushed
the
feat/completion
branch
from
August 7, 2026 08:27
7cd2b38 to
6c1ae7e
Compare
Author
|
No worries! Almost no conflicts 😄 The PR is ready for review now. Just one thing, not sure how to handle the 7 |
cachelous
marked this pull request as ready for review
August 7, 2026 08:31
Author
|
Went ahead and silenced the |
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.
Part of #343. For now only bash is supported, I will work on zsh/fish on later PRs.
Instead of generating a static script that encodes the app's options, the script is a small fixed adaptor: it re-invokes the binary with the line being completed, and the binary replies with candidates and a directive. Rationale in #343. A detailed explanation is included in
book/chapters/completion.md.How to try it out
To see the current state of completion in action (from a bash shell with
bash-completion):To see the wire protocol directly, without a shell in the way:
Status
Working end to end for bash:
--opt=value, and values written onto short names and bundles--and++/flag:valueunderallow_windows_style_optionsignore_caseandignore_underscorethe way a parse doesDeliberately not in this PR, happy to follow up:
Optioncompletion callbacks--sub.opttakes a value)Reviewing commit-by-commit will be easier than the squashed diff, as each commit is one capability with its own tests.