book icon indicating copy to clipboard operation
book copied to clipboard

Book: Section on config-description

Open matthiasbeyer opened this issue 3 years ago • 1 comments

As requested in https://github.com/rust-cli/book/pull/166#discussion_r972045274 I'd like to open up a discussion about config description.

The general idea of what I call "config description" here is that a given configuration type can describe itself in a machine-readable way, which can ultimatively be rendered to user-documentation.

A user would ask the program "tell me how I can configure you?" and the program is then able to tell the user "I get configured via the following settings: 'greeting_message', which has to be a String, 'repeat', which has to be a number greater than zero".

A possible solution for this is sketched out in #166 using the type_description crate.

matthiasbeyer avatar Sep 16 '22 11:09 matthiasbeyer

Alternatives

  • In git-fixture, I use schemars to generate a schema
  • In cargo-release, I provide a --dump-config flag to show the user all layers of the config merged
    • This is more "documentation by example"
    • Also allows the user to debug their configuration
    • Provides transparency on defaults

epage avatar Sep 16 '22 14:09 epage