diff --git a/src/commands/config.rs b/src/commands/config.rs index f7b15105..98c1497a 100644 --- a/src/commands/config.rs +++ b/src/commands/config.rs @@ -45,7 +45,7 @@ fn get(sq: Sq, cmd: config::get::Command) -> Result<()> { let mut acc = Default::default(); // First, look in the configuration. - let config = sq.config_file.augment_with_policy(&sq.policy)?; + let config = sq.config_file.effective_configuration(&sq)?; let r0 = Node::traverse(&*config.as_item() as _, &path) .map_err(Into::into) .and_then( diff --git a/src/config.rs b/src/config.rs index 87fa8de2..2ef163fd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -390,19 +390,20 @@ impl ConfigFile { Ok(()) } - /// Augments the configuration with the given policy. + /// Augments the configuration with the effective configuration + /// and policy. /// /// XXX: Due to the way doc.remove works, it will leave misleading /// comments behind. Therefore, the resulting configuration is /// not suitable for dumping, but may only be used for /// commands::config::get. - pub fn augment_with_policy(&self, p: &StandardPolicy) -> Result { + pub fn effective_configuration(&self, sq: &crate::Sq) -> Result { use std::io::Write; let mut raw = Vec::new(); // First, start with our configuration, and drop most of the // policy with the exception of the path. - let p = ConfiguredStandardPolicy::from_policy(p.clone()); + let p = ConfiguredStandardPolicy::from_policy(sq.policy.clone()); let mut doc = self.doc.clone(); doc.remove("policy");