telepresence icon indicating copy to clipboard operation
telepresence copied to clipboard

add completion subcommand

Open raphaelreyna opened this issue 2 years ago • 5 comments

Signed-off-by: Raphael Reyna [email protected]

Description

Adds a completion subcommand to generate a completion script for the given shell (addresses #538). Also adds the line see 'telepresence <subcommand_name> -h' for help on errcat.User errors.

Checklist

  • [x] I made sure to update ./CHANGELOG.md.
  • [x] I made sure to add any docs changes required for my change (including release notes).
  • [x] My change is adequately tested.
  • [ ] I updated DEVELOPING.md with any any special dev tricks I had to use to work on this code efficiently.
  • [ ] I updated TELEMETRY.md if I added, changed, or removed a metric name.
  • [ ] Once my PR is ready to have integration tests ran, I posted the PR in #telepresence-dev in the datawire-oss slack so that the "ok to test" label can be applied.

raphaelreyna avatar Jun 17 '22 22:06 raphaelreyna

out of curiosity, what does the default completion generation look like?

jef avatar Jun 20 '22 16:06 jef

out of curiosity, what does the default completion generation look like?

@jef, do you mean if no shell is passed as an argument (just running telepresence completion)? if so then the user gets the message:

telepresence: error: shell not specified
see 'telepresence completion -h' for help

raphaelreyna avatar Jun 21 '22 18:06 raphaelreyna

sorry for being vague. what i mean is: isn't there an implementation built-in without your addCompletionCommand(rootCmd) function? i ask only because i've written some (much smaller) cobra cli tools that didn't need much to generate. that said, perhaps this extends it much more! thanks 😌

jef avatar Jun 21 '22 22:06 jef

sorry for being vague. what i mean is: isn't there an implementation built-in without your addCompletionCommand(rootCmd) function? i ask only because i've written some (much smaller) cobra cli tools that didn't need much to generate. that said, perhaps this extends it much more! thanks relieved

ah, yeah this was a feature of the cobra cli tool that I believe is no longer supported.

raphaelreyna avatar Jun 23 '22 18:06 raphaelreyna

I believe is no longer supported.

makes a lot more sense! 😅 thanks for your feedback 😊

jef avatar Jun 27 '22 18:06 jef