Skip to content

Option to manually hook up dynamic autocomplete #263

Answered by pacak
DanCardin asked this question in Q&A
Discussion options

You must be logged in to vote

So if I were to manually copy-paste your shell code in https://github.com/pacak/bpaf/blob/master/src/complete_run.rs (and execute, on my own command), which call out to the (un-help-message'd) option --bpaf-complete-rev=, then it'd "just work"(?)

That is correct.

Is there a public-api way for me to invoke that from a subcommand without copying them?

Sort of. You can call your own executable with --bpaf-complete-style-zsh or similar option and capture the output. Users will have to do it at most once so it should be fine. Alternatively you can call this flag as part of your test suite, store the output somewhere and produce it when user calls the command you want. Or put those snippets…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@DanCardin
Comment options

@pacak
Comment options

@DanCardin
Comment options

@pacak
Comment options

Answer selected by DanCardin
@DanCardin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
next gen Might or might not happen completion All the things related to shell completion
2 participants
Converted from issue

This discussion was converted from issue #262 on August 08, 2023 12:49.