Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add builder tab-completion script #12296

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jahorton
Copy link
Contributor

@jahorton jahorton commented Aug 27, 2024

This adds a new resource script - ${KEYMAN_ROOT}/resources/builder_completion.sh. When sourced by a terminal's .bashrc or similar, this script performs tab-completion for any of our builder-based scripts (named build.sh or test.sh), expanding for any supported matching actions, targets, and options.

Example use case - autocompleting a paired action:target command

example usage

To do this, it also adds a hidden option to builder scripts currently called --builder_completion_describe, which enumerates all actions, then targets, then options in a format easily parsed by the completion script.

Autocompletion from empty-string

full enumeration

@keymanapp-test-bot skip

@keymanapp-test-bot keymanapp-test-bot bot added this to the A18S9 milestone Aug 27, 2024
local _builder_opts=()
for e in "${!_builder_params[@]}"; do
if [[ $e =~ ^-- ]]; then
_builder_opts+=(${e%+*})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes all + suffixes from options.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes all + suffixes from options.

This should be a code comment

@jahorton jahorton changed the title feat: add builder autocompletion script feat: add builder tab-completion script Aug 27, 2024
@jahorton
Copy link
Contributor Author

Accidentally put a commit on the wrong branch for a moment; undid that via a git reset HEAD~1 & the force-push.

@jahorton
Copy link
Contributor Author

The Language Modeling Layer test failure will be addressed by 8c4c485 on #12115.

@jahorton
Copy link
Contributor Author

jahorton commented Aug 28, 2024

Hmm... looks like macOS's zsh requires a different setup; researching that now. (The bash method to register the completion script isn't supported by zsh.)

This may provide a useful first step: https://stackoverflow.com/a/8492043

@mcdurdin
Copy link
Member

I would like to review this before it is merged. However this week I am at capacity. I am happy to take on making any updates and merge, as @jahorton will be away.

@mcdurdin mcdurdin modified the milestones: A18S10, A18S19 Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants