infra to synthesize program options with config options
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
59efabbbc2
commit
2fb43dd38d
4 changed files with 16 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
use conduit::{Config, Result};
|
||||
|
||||
/// Commandline arguments
|
||||
#[derive(Parser, Debug)]
|
||||
|
@ -15,4 +16,13 @@ pub(crate) struct Args {
|
|||
|
||||
/// Parse commandline arguments into structured data
|
||||
#[must_use]
|
||||
pub(crate) fn parse() -> Args { Args::parse() }
|
||||
pub(super) fn parse() -> Args { Args::parse() }
|
||||
|
||||
/// Synthesize any command line options with configuration file options.
|
||||
pub(crate) fn update(config: &mut Config, args: &Args) -> Result<()> {
|
||||
// Indicate the admin console should be spawned automatically if the
|
||||
// configuration file hasn't already.
|
||||
config.admin_console_automatic |= args.console.unwrap_or(false);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue