-
Notifications
You must be signed in to change notification settings - Fork 276
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
[documentation] #3509: Generate Kagami CLI help as Markdown #3510
Conversation
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
tools/kagami/CLI.md
Outdated
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.
I don't like the format that clap-markdown
produces for a couple of reasons:
- Mix of
##
and#####
- Using bold in headers:
##### **Options:**
- Inconsistent spacing
↴
character
Not critical though
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.
Also, it ignores additional text in arguments doccomments and only includes the first line.
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.
What do you mean by this? From what I see, the doccomments are included in full (e.g. for genesis or crypto). Or did you mean that it doesn't preserve formatting without the verbatim
attribute?
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.
@ilchu, see: #3510 (comment)
Signed-off-by: Dmitry Balashov <[email protected]>
It is not much code to write a better docgen implementation. It might be used for other CLIs as well. |
tools/kagami/CLI.md
Outdated
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.
What do you mean by this? From what I see, the doccomments are included in full (e.g. for genesis or crypto). Or did you mean that it doesn't preserve formatting without the verbatim
attribute?
tools/kagami/CLI.md
Outdated
* `client` — | ||
* `peer` — |
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.
Would be good to have short descriptions here as well. Could be done by carrying over the old examples directly into the Args::Config
docstring, just like you did with Args::Genesis
, I suppose.
tools/kagami/CLI.md
Outdated
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.
Also would prefer some different title, as either the old README.md
or maybe kagami.md
sound more descriptive to me. And maybe have this markdown generation a part of our CI, just like e.g. schema is (could be a separate small PR though).
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.
It definitely should be a part of CI.
tools/kagami/CLI.md
Outdated
## `kagami tokens` | ||
|
||
Generate a list of predefined permission tokens and their parameters | ||
|
||
**Usage:** `kagami tokens` |
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.
The comment about Args::Config
also applies here, despite this part being insubstantial. Even though it's just two small and obvious examples there, I don't think we lose much by omitting them, but being more explicit never hurts.
Been thinking about this too, you mean ditching the whole |
Hmm, as far as I understand you are speaking about Iroha configuration documentation, which is generated by Here I mean that |
tools/kagami/CLI.md
Outdated
* `--image <IMAGE>` — Use specified docker image | ||
* `--build <PATH>` — Use local path location of the Iroha source code to build images from | ||
* `--build-from-github` — Clone `hyperledger/iroha` repo from the revision Kagami is built itself, and use the cloned source code to build images from | ||
* `-p`, `--peers <PEERS>` — How many peers to generate within the docker-compose | ||
* `--outdir <OUTDIR>` — Target directory where to place generated files | ||
* `--outdir-force` — Re-create the target directory if it already exists | ||
* `--no-default-configuration` — Do not create default configuration in the `<outdir>/config` directory | ||
* `-s`, `--seed <SEED>` — Might be useful for deterministic key generation |
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.
Here is the example of that clap-markdown
doesn't render additional documentation for arguments. Even if I put #[clap(verbatim_doc_comment)]
.
For example, --no-default-configuration
's full documentation is as follows:
Do not create default configuration in the
<outdir>/config
directory.Default
config.json
,genesis.json
andvalidator.wasm
are generated and put into
the<outdir>/config
directory. That directory is specified in the Docker Compose
volumes
field.If you don't need the defaults, you could set this flag. The
config
directory will be
created anyway, but you should put the necessary configuration there by yourself.
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.
Ah, now I see it, thanks. So it doesn't recurse into the submodules args fully. That should be trivially fixable with a home-brew implementation (and sounds really close to what Documented
does already anyways).
tools/kagami/CLI.md
Outdated
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.
It definitely should be a part of CI.
Signed-off-by: Dmitry Balashov <[email protected]>
Signed-off-by: Dmitry Balashov <[email protected]>
Co-authored-by: Ilia Churin <[email protected]> Signed-off-by: 0x009922 <[email protected]>
…into 3509-kagami-clap-markdown # Conflicts: # tools/kagami/src/main.rs
That's indeed what I was talking about. Then I'll see if I actually can come up with anything actionable up there! |
I'm a bit bothered that running subcommands with |
I agree. It would be nice to be able to affect how So, maybe the whole PR is pointless and we should not try combining help message with README docs? Or avoid Markdown in docstrings? But it is a standard for docstrings to be Markdown, so it seems more reasonable to support it from the |
To summarize our recent conversation, I like the format for the generated docs. Thank you for the detailed demo with Asciinema. |
See: #3509 (comment) |
Description
Self-explanatory PR title.
Linked issue
Closes #3509
Benefits
Same documentation (from doccomments) for both CLI and GitHub.
Checklist
kagami swarm
#3475clap-markdown
or with a self-made tool