Add chapter on describing config types#166
Draft
matthiasbeyer wants to merge 1 commit intorust-cli:masterfrom
Draft
Add chapter on describing config types#166matthiasbeyer wants to merge 1 commit intorust-cli:masterfrom
matthiasbeyer wants to merge 1 commit intorust-cli:masterfrom
Conversation
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
epage
reviewed
Sep 15, 2022
| @@ -0,0 +1,46 @@ | |||
| # Rendering documentation for your Configuration | |||
Contributor
There was a problem hiding this comment.
Could you open a discussion for us to discuss this first?
There are a lot of potential directions to go and I tend to prefer the solution discover to happen in issues as PRs are more likely to come and go.
epage
reviewed
Sep 15, 2022
Comment on lines
19
to
+20
| - [Rendering documentation for your CLI apps](./in-depth/docs.md) | ||
| - [Rendering documentation for your Configuration](./in-depth/render-configuration.md) |
Contributor
There was a problem hiding this comment.
What do you feel is the line for this being in the CLI documentation vs being in its own page?
epage
reviewed
Sep 15, 2022
| You could render them straight to the terminal, so that a user can "ask" your | ||
| app what configuration it provides: | ||
|
|
||
| ```commandline |
epage
reviewed
Sep 15, 2022
| myapp print-config-options | ||
| ``` | ||
|
|
||
| Using the [type_description crate](https://crates.io/crates/type_description) |
Contributor
There was a problem hiding this comment.
We should update the list of referenced crates at the end of the book
epage
reviewed
Sep 15, 2022
Comment on lines
+16
to
+32
| ```rust,ignore | ||
| use type_description::AsTypeDescription; | ||
| use type_description::TypeDescription; | ||
| use type_description::TypeKind; | ||
| use type_description::Sign; | ||
|
|
||
| /// A configuration | ||
| #[derive(TypeDescription)] | ||
| struct Config { | ||
| /// The bind address | ||
| addr: std::net::SocketAddr, | ||
|
|
||
| /// The Port | ||
| port: u16, | ||
| } | ||
| ``` | ||
|
|
Contributor
There was a problem hiding this comment.
All code samples should be extracted from full programs that we compile in CI and can be run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a bit of a shameless self-plug. The mentioned
type_descriptioncrate was a by-product of some work @TheNeikos and I have done and we've used it already to do exactly what the article describes.Maybe @TheNeikos wants to add some comments before this gets considered, so this goes as draft for now.