Expand description
Command-line extensions for smart-config library.
The extensions are as follows:
- Printing help for configuration params with optional filtering.
- Debugging param values and deserialization errors.
All extensions are encapsulated in Printer.
§Examples
See the crate readme or the examples dir for captured output samples.
§Printing help
use smart_config::ConfigSchema;
use smart_config_commands::Printer;
let mut schema = ConfigSchema::default();
// Add configurations to the schema...
Printer::stderr().print_help(&schema, |_| true)?;§Debugging param values
use smart_config::{ConfigSchema, ConfigRepository};
use smart_config_commands::Printer;
let mut schema = ConfigSchema::default();
// Add configurations to the schema...
let mut repo = ConfigRepository::new(&schema);
// Add sources to the repository...
Printer::stderr().print_debug(&repo, |param_ref| {
// Allows filtering output params
param_ref.canonical_path().starts_with("test.")
})?;