/// Argument is (comma-separated) list of config keys;
/// values will be printed space-separated.
/// The key `pretty` dumps the whole config in a pretty debug format.
+ ///
+ /// If none of the specified config keys are client-specific,
+ /// only one line will be printed. Otherwise the output will
+ /// have one line per client association.
#[clap(long)]
print_config: Option<String>,
}
{
let global_config = config::InstanceConfigGlobal::from(&ics);
- PrintConfigOpt(&opts.print_config)
- .implement(&mut iter::once(&global_config))?;
+ {
+ let pc = PrintConfigOpt(&opts.print_config);
+
+ if pc.keys().all(|k| global_config.inspect_key(k).is_some()) {
+ pc.implement(&mut iter::once(&global_config))?;
+ } else {
+ pc.implement(&mut ics.iter())?;
+ }
+ }
if let Some(pidfile_path) = opts.pidfile.as_ref() {
(||{
}
}
+ pub fn keys(&self) -> impl Iterator<Item=&str> {
+ self.0.as_ref().map(|arg| Self::split(arg)).into_iter().flatten()
+ }
+
fn split(arg: &str) -> impl Iterator<Item=&str> { arg.split(',') }
#[throws(AE)]