| Crates.io | smart-config-commands |
| lib.rs | smart-config-commands |
| version | 0.4.0-pre |
| created_at | 2025-06-05 12:31:55.153304+00 |
| updated_at | 2025-09-23 12:30:00.25062+00 |
| description | Command-line extensions for `smart-config` library |
| homepage | |
| repository | https://github.com/matter-labs/smart-config |
| max_upload_size | |
| id | 1701407 |
| size | 201,337 |
smart-configThis library provides a couple of command-line extensions for the smart-config library:
Add this to your Crate.toml:
[dependencies]
smart-config-commands = "0.4.0-pre"
use std::io;
use smart_config::ConfigSchema;
use smart_config_commands::Printer;
let mut schema = ConfigSchema::default();
// Add configurations to the schema...
Printer::stdout().print_help(&schema, |param_ref| {
// Allows filtering output params.
param_ref.param.name.contains("test")
})?;
io::Result::Ok(())
Example output is as follows:
use std::io;
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 repo...
Printer::stdout().print_debug(&repo, |_| true)?;
io::Result::Ok(())
Example output is as follows:
The output will contain deserialization errors for all available params:
The library can fancy-print JSON and YAML. This be used together with smart-config tooling to produce default / example configs,
diffs with default param values etc. See the example for a couple of use cases.
Distributed under the terms of either
at your option.