rustit/01_phase_rust_src/sv/src/main.rs

41 lines
722 B
Rust
Raw Normal View History

2024-04-05 18:34:08 +02:00
2024-04-05 21:12:55 +02:00
//mod misc;
mod parser;
2024-04-05 18:34:08 +02:00
use std::env;
2024-03-25 00:57:14 +01:00
fn main() {
2024-04-05 18:34:08 +02:00
let args: Vec<String> = env::args().collect();
2024-04-05 21:12:55 +02:00
2024-04-05 23:00:23 +02:00
// def env variables.
let svdir_env = env::var("SVDIR");
2024-04-05 23:10:11 +02:00
let svwait_env = env::var("SVWAIT");
2024-04-05 23:00:23 +02:00
let svdir_var = match svdir_env {
Ok(var) => var,
Err(..) => "/run/runit/service".to_string(),
};
2024-04-05 23:10:11 +02:00
// TODO: check if directory exists
let svwait_var = match svwait_env {
Ok(env) => match env.parse::<i32>() {
Ok(var) => var,
Err(..) => 7,
},
Err(..) => 7,
};
2024-04-05 23:00:23 +02:00
dbg!(svdir_var);
2024-04-05 23:10:11 +02:00
dbg!(svwait_var);
2024-04-05 23:00:23 +02:00
2024-04-05 21:12:55 +02:00
// args
let arg_parser: Vec<String> = parser::parse_args(args);
dbg!(arg_parser);
//dbg!(args);
2024-03-25 00:57:14 +01:00
}