-
Notifications
You must be signed in to change notification settings - Fork 930
docs: Add CLI docs #5879
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
docs: Add CLI docs #5879
Conversation
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.
Preview: https://coder.com/docs/v2/6b5f959/cli/coder
We should change the icon so it's not the same as API. We'll also have to strip the weird ANSI sequences.
@kylecarbs Do you know if it is going to happen for prod as well? |
It is not showing the options in a good way, but I think it is an issue in the code on the docs website. I'm going to fix/improve it as soon as this gets merged. |
I'm also getting an error in the fmt check:
Looks like the command description is a bit different from what is generated. For scenarios like these, I'm thinking on use an env var called |
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.
Looks like the command description is a bit different from what is generated. For scenarios like these, I'm thinking on use an env var called CLI_ENV and check if its value is docs, if it is docs, the default value helper should not be added. Thoughts?
It's more like a hack, but should do its work 👍 .
I think would be interesting to inject this value into the CLI but I'm not sure how to make it using Go and the current library. If I would make it using JS it would look like this: const ci = new CI({ defaultConfigDir: "..." }) Thoughts? |
You can take a look at the TestCommandHelp, which overwrites defaults. There is |
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.
👍
Left 2 nitpicks, but this is in a good shape to merge.
scripts/clidocgen/main.go
Outdated
// Remove non printable strings from generated markdown | ||
// https://github.com/spf13/cobra/issues/1878 | ||
const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))" | ||
ansiRegex := regexp.MustCompile(ansi) |
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.
nit: Oh, I meant, top top, for instance, line 29.
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.
Ahhh, I see. But I think would be better to have them together since they are only used here. It makes it easier to reason about IMO but no strong opinions.
Add auto-generated docs for CLI