From 41aeef83d45d206632f424b762c4b761386e9b52 Mon Sep 17 00:00:00 2001 From: brevalferrari Date: Fri, 6 Jun 2025 00:57:25 +0200 Subject: [PATCH] fix cli variable override --- src/cli/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cli/main.rs b/src/cli/main.rs index dd15702..91ee81d 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -97,8 +97,9 @@ fn parse_and_compile(opts: &PlayOpts) -> anyhow::Result> { opts.slopes() .map(|(s, (v, e))| (s, VariableChange(*v, e.clone()))) .collect::>(), - opts.variables() - .chain(HashMap::from(default_variables).iter()) + HashMap::from(default_variables) + .iter() + .chain(opts.variables()) .map(|(v, _)| *v) .collect::>(), ); @@ -118,9 +119,10 @@ fn parse_and_compile(opts: &PlayOpts) -> anyhow::Result> { let compiler = Compiler::from(Context::new( 'L'.to_string(), 'n'.to_string(), - opts.variables() - .map(|(a, b)| (a.to_string(), *b)) - .chain(default_variables.map(|(c, v)| (c.to_string(), v))), + default_variables + .map(|(c, v)| (c.to_string(), v)) + .into_iter() + .chain(opts.variables().map(|(a, b)| (a.to_string(), *b))), opts.instrument().clone(), opts.slopes() .map(|(_, (a, b))| (a.to_string(), b.clone()))