-
Notifications
You must be signed in to change notification settings - Fork 56
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: support shell completions in tedge
cli
#3332
feat: support shell completions in tedge
cli
#3332
Conversation
Codecov ReportAttention: Patch coverage is Additional details and impacted files📢 Thoughts on this report? Let us know! |
Robot Results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this PR with zsh
I noticed some weirdness, however overall completion is working nicely.
Completion on tedge config set
is fantastic!
The weirdness seems to be due to the overly complicated argument logic of thin-edge.
- e.g.
--config-dir
,--debug
,--log-level
are never proposed for completion
fn qos_completions() -> Vec<CompletionCandidate> { | ||
vec![ | ||
CompletionCandidate::new("0").help(Some("At most once".into())), | ||
CompletionCandidate::new("1").help(Some("At least once".into())), | ||
CompletionCandidate::new("2").help(Some("Exactly once".into())), | ||
] | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice
$ tedge mqtt pub --qos <TAB>
0 -- At most once
1 -- At least once
2 -- Exactly once
#[clap(long = "output-path", global = true, value_hint = ValueHint::FilePath)] | ||
output_path: Option<Utf8PathBuf>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might have to add this hint for other path (e.g. --config-dir
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I also need to make a modification to support the global arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the hint and fixed the issue where the global arguments weren't completed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance to get the --log-level
value also completed? e.g. tedge --log-level <TAB><TAB>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, works as expected
Now fixed |
7a2c5b8
to
3e2332b
Compare
Signed-off-by: James Rhodes <[email protected]>
3e2332b
to
1cf7710
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving (from a UX point of view). Still wait for a Rust review.
Really nice addition. We can work out any packaging aspects in a follow up PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Quickly and nicely done.
/// This will infer the profile names from the various cloud configurations. | ||
/// It would be significantly more complicated to try and do per-cloud | ||
/// completions, and would likely provide no real value to anyone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems reasonable.
Proposed changes
This adds shell completions (bash, zsh, fish) to the
tedge
CLI. It should be fairly self explanatory, and the documentation added in the PR should explain how you can enable the feature for testing locally.Types of changes
Paste Link to the issue
tedge
CLI #3331Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments