first cli (wip)

This commit is contained in:
2023-03-27 17:53:41 +02:00
commit 4725e096f4
9 changed files with 1636 additions and 0 deletions

35
src/main.rs Normal file
View File

@@ -0,0 +1,35 @@
extern crate serde;
extern crate clap;
mod cli;
mod config;
mod planning;
use std::fs;
use std::path::PathBuf;
use clap::Parser;
use cli::Cli;
use config::Config;
use crate::cli::Commands::Planning;
use crate::cli::Planning::I2work;
fn main() {
let cli = Cli::parse();
let default_config_path = PathBuf::from("/etc/config.toml");
let config_path = match cli.config.as_deref() {
Some(p) => p,
None => &default_config_path
};
let config_path_content = fs::read_to_string(config_path)
.expect("Could not read config file");
let config: Config = toml::from_str(&*config_path_content).expect("Could not parse config");
match cli.command {
Some(Planning(I2work(args))) => {
planning::issue2work::issue2work(config, &args);
},
None => {}
}
}