Set the policy's reference time to the configured reference time

- If the user specifies `--time`, then use it, not the current time,
    as the reference time for the policy object.
This commit is contained in:
Neal H. Walfield 2023-03-25 13:53:00 +01:00
parent 16fd67a10c
commit 7b4ed970af
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3

View File

@ -666,16 +666,8 @@ fn main() -> Result<()> {
return Ok(())
}
let policy = &mut P::new();
let c = sq_cli::SqCommand::from_arg_matches(&sq_cli::build().get_matches())?;
let known_notations = c.known_notation
.iter()
.map(|n| n.as_str())
.collect::<Vec<&str>>();
policy.good_critical_notations(&known_notations);
let time = if let Some(time) = c.time {
SystemTime::from(
crate::parse_iso8601(
@ -685,6 +677,14 @@ fn main() -> Result<()> {
SystemTime::now()
};
let policy = &mut P::at(time);
let known_notations = c.known_notation
.iter()
.map(|n| n.as_str())
.collect::<Vec<&str>>();
policy.good_critical_notations(&known_notations);
let force = c.force;
let output_format = OutputFormat::from_str(&c.output_format)?;
let output_version = if let Some(v) = c.output_version {