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

Is there an API to output the shell completion file manually in the script? #379

Open
NMZ0429 opened this issue Jul 26, 2024 · 2 comments
Open

Comments

@NMZ0429
Copy link

NMZ0429 commented Jul 26, 2024

According to the README, the following command is used to output the shell completion

$ your_program --bpaf-complete-style-zsh > ~/.zsh/_your_program

I am making a CLI app and want to implement the sub command complete that does what the above command do and move the completion file to specific directory to automate the shell completion setup. Yet, as I checked the docs, I could not find anything regarding the generation of the completion file ( I only found complete and complete_shell macro).
Is there any public function that is working behind --bpaf-complete-style-zsh ?

@pacak
Copy link
Owner

pacak commented Jul 26, 2024

Not at the moment. But you can execute your own program again with this flag. So user calls your_program complete and the program then prepares and executes command your_program --bpaf-complete-style-zsh.

I'll try to make this bit of API public at some point.

@NMZ0429
Copy link
Author

NMZ0429 commented Jul 27, 2024

Thank you so much for your prompt reply.
Your suggestion works greatly as I have tasted it with my CLI application! I can generate the shell completion script within the application using std::process::Command::new("my-application"). I will leave this issue open but please close it if you don't need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants