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 auto completion shell support for poststation-cli #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thaodt
Copy link

@thaodt thaodt commented Feb 15, 2025

While playing around with Poststation, I thought it'd be nice if I could use <TAB> so the cli utils could suggest what args or sub-commands I should use next, this little PR supports that feature.

a small note here is that to maintain the current behavior of DeviceCommands, I've changed a little bit in Logs and LogsRange args from optional to default value, this is to avoid clap validation issue that required positional arguments must come before optional ones in the command definition.
otherwise it will cause an error when building similar to the following error:

thread 'main' panicked at /home/thaodinh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.5.20/src/builder/debug_asserts.rs:638:17:
Found non-required positional argument with a lower index than a required positional argument: "count" index Some(1)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

please let me know if you think this is unreasonable.

Also the approach when generating specific shell auto-completion is to immediately process that command first instead of waiting for network connection and handle later. Because I think this feature does not need network connection to generate.

Support auto-completion for your shell.
@thaodt
Copy link
Author

thaodt commented Feb 18, 2025

hi @jamesmunns can you take a look on this?

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

Successfully merging this pull request may close these issues.

1 participant