Compare commits

..

4 commits

Author SHA1 Message Date
78a6a89988 Merge pull request 'make_vars' (#3) from make_vars into main
Reviewed-on: https://gitea.ahur.ac/statzitz/rustit/pulls/3
2024-04-05 23:19:32 +02:00
primardj
0db8158795 remove an useless TODO and add three good ones. 2024-04-05 22:19:10 +01:00
primardj
989025fe69 add env var SVWAIT 2024-04-05 22:10:11 +01:00
primardj
a66357a179 check value env variable SVDIR 2024-04-05 22:00:23 +01:00

View file

@ -5,13 +5,40 @@ mod parser;
use std::env; use std::env;
fn main() { fn main() {
// def env variables.
let svdir_env = env::var("SVDIR");
let svwait_env = env::var("SVWAIT");
let svdir_var = match svdir_env {
Ok(var) => var,
Err(..) => "/run/runit/service".to_string(),
};
let svwait_var = match svwait_env {
Ok(env) => match env.parse::<i32>() {
Ok(var) => var,
Err(..) => 7,
},
Err(..) => 7,
};
dbg!(svdir_var);
dbg!(svwait_var);
// run the parser
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
// args
let arg_parser: Vec<String> = parser::parse_args(args); let arg_parser: Vec<String> = parser::parse_args(args);
dbg!(arg_parser); dbg!(arg_parser);
//dbg!(args); // 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.
} }