Repository navigation
Use YAML for CLI command generation - #666
Conversation
|
the new format does not allow enum options for a |
| - name: raw | ||
| type: bool | ||
| description: Print properties without changing their format. | ||
| default: true |
There was a problem hiding this comment.
Description for this option used to be
* `--raw` (bool) -
Print properties without changing their format.
Defaults to true.
Which states defaults to true, but the code didn't seem to support that. Should this be removed from the description? A bool that defaults to true feels weird/doesn't make sense.
| s.Command.Flags().StringVar(&s.Description, "description", "", "Endpoint description in markdown format (encoded using the configured codec server).") | ||
| s.Command.Flags().StringVar(&s.DescriptionFile, "description-file", "", "Endpoint description file in markdown format (encoded using the configured codec server).") | ||
| s.Command.Flags().StringVar(&s.Description, "description", "", "Endpoint description in markdown format (encoded using the configured codec server).\n") | ||
| s.Command.Flags().StringVar(&s.DescriptionFile, "description-file", "", "Endpoint description file in markdown format (encoded using the configured codec server).\n") |
There was a problem hiding this comment.
Same question as above—with options, I would expect this to be more of a problem, since it might mess up the formatting/spacing of options if some have a trailing \n and some don't.
There was a problem hiding this comment.
good point, I've removed all \n from the options, generated output should match previous markdown formatting
15a7549 to
ee16399
Compare
josh-berry
left a comment
There was a problem hiding this comment.
I'll be honest that I didn't read the parser/generator changes super closely; I mostly looked at the generated output, which seems good to me. There's only one small comment about the log-format flag that's not a blocker for merging IMO. Otherwise LGTM!
| s.Command.PersistentFlags().StringVar(&s.LogFormat, "log-format", "", "Log format. Options are: text, json. Defaults to: text.") | ||
| s.Command.PersistentFlags().StringVar(&s.LogFormat, "log-format", "text", "Log format. Options are: text, json.") |
There was a problem hiding this comment.
There was some reason we didn't want the default to be programmatically-encoded that I can't remember. Can you double-check this and make sure it's not changing behavior somehow?
|
Actually, one other thought: let's wait for @cretz to take a look before merging in case he spots something I didn't. |
| Log level. | ||
| Default is "info" for most commands and "warn" for `server start-dev`. |
There was a problem hiding this comment.
Are we expected to retain the one-sentence-per-line approach? If so, how come done in options description but not command description? (do not need to fix, more for general discussion)
There was a problem hiding this comment.
No, I want to get rid of this eventually and use a proper Markdown renderer for both the description and flags. The reason it was needed for flags is because newlines show up in the generated output, so having newlines inserted in (to-the-user) random places really doesn't look good. I think Andrew has since fixed this? In which case I have no opinion.
There was a problem hiding this comment.
I think we should have a general/consistent rule for Markdown description. Right now it seems a bit inconsistent.
There was a problem hiding this comment.
Agree, eventually; we can make this consistent once we have a proper Markdown formatter IMO.
| type: string | ||
| description: | | ||
| Log format. | ||
| Options are: text, json. |
There was a problem hiding this comment.
There are more options than this, but I know this is a docs problem. No need to fix, can ignore. Henceforth in this PR I won't be commenting on things that are already a problem in main.
| @@ -0,0 +1,192 @@ | |||
| // Package commandsgen is built to read the markdown format described in | |||
| // temporalcli/commands.md and generate code from it. | |||
There was a problem hiding this comment.
This statement is not accurate anymore
| gen: temporalcli/commands.gen.go | ||
|
|
||
| temporalcli/commands.gen.go: temporalcli/commandsmd/commands.md | ||
| temporalcli/commands.gen.go: temporalcli/commandsgen/commands.md |
There was a problem hiding this comment.
This still references commands.md. In a perfect world this would have failed CI with something like:
No rule to make target 'temporalcli/commandsgen/commands.md', needed by 'temporalcli/commands.gen.go'
But unfortunately this Makefile is an untested/undocumented thing just sitting in the repo
There was a problem hiding this comment.
oops, thanks for catching this!
What was changed
Moved from Markdown to YAML for CLI command generation.
This switch also fixes a bug where option set aliases weren't being persisted to commands that use them (i.e.
NewTemporalScheduleCreateCommand)Why?
More standardized format, easier to parse and add to
Checklist
Closes Switch to a common format for CLI command generation #620
How was this tested:
Passes all CI tests