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

45 lines
837 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 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
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
// run the parser
let args: Vec<String> = env::args().collect();
2024-04-05 21:12:55 +02:00
let arg_parser: Vec<String> = parser::parse_args(args);
dbg!(arg_parser);
// TODO: Interpret the flags given if some are given.
// TODO: Set the command if it is given
// TODO: Exec the command on all given services.
2024-04-05 21:12:55 +02:00
2024-03-25 00:57:14 +01:00
}