From 2abf48d9ce2968f7e999a9e0faf6d0ebfa752c7c Mon Sep 17 00:00:00 2001 From: Sakarias Johansson Date: Wed, 18 Jan 2023 21:01:24 +0100 Subject: =?UTF-8?q?=F0=9F=8F=99=EF=B8=8F=20Add=20support=20for=20reading?= =?UTF-8?q?=20scene=20from=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- racer-tracer/src/config.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'racer-tracer/src/config.rs') diff --git a/racer-tracer/src/config.rs b/racer-tracer/src/config.rs index 109528a..79c50eb 100644 --- a/racer-tracer/src/config.rs +++ b/racer-tracer/src/config.rs @@ -28,6 +28,21 @@ pub struct Args { env = "CONFIG" )] pub config: String, + + #[structopt(short = "s", long = "scene")] + pub scene: Option, +} + +impl TryFrom for Config { + type Error = TracerError; + fn try_from(args: Args) -> Result { + Config::from_file(args.config).map(|mut cfg| { + if args.scene.is_some() { + cfg.scene = args.scene; + } + cfg + }) + } } #[derive(Default, Debug, Deserialize)] @@ -40,6 +55,9 @@ pub struct Config { #[serde(default)] pub screen: Screen, + + #[serde(default)] + pub scene: Option, } impl Config { -- cgit v1.2.3