summaryrefslogtreecommitdiff
path: root/racer-tracer/src/config.rs
diff options
context:
space:
mode:
authorSakarias Johansson <sakarias.johansson@goodbyekansas.com>2023-01-18 21:01:24 +0100
committerSakarias Johansson <sakarias.johansson@goodbyekansas.com>2023-01-18 21:01:24 +0100
commit2abf48d9ce2968f7e999a9e0faf6d0ebfa752c7c (patch)
tree3b58470a7f382634187ba155a1ed398595247a35 /racer-tracer/src/config.rs
parent38e9bf130fc1075d576626f0c2ade582ccc3c57f (diff)
downloadracer-tracer-2abf48d9ce2968f7e999a9e0faf6d0ebfa752c7c.tar.gz
racer-tracer-2abf48d9ce2968f7e999a9e0faf6d0ebfa752c7c.tar.xz
racer-tracer-2abf48d9ce2968f7e999a9e0faf6d0ebfa752c7c.zip
🏙️ Add support for reading scene from file
Diffstat (limited to 'racer-tracer/src/config.rs')
-rw-r--r--racer-tracer/src/config.rs18
1 files changed, 18 insertions, 0 deletions
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<String>,
+}
+
+impl TryFrom<Args> for Config {
+ type Error = TracerError;
+ fn try_from(args: Args) -> Result<Self, TracerError> {
+ 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<String>,
}
impl Config {