Get config_file from command args

This commit is contained in:
Zykino
2023-01-14 21:30:43 +01:00
parent 7c765fd48e
commit f6813025a3
4 changed files with 294 additions and 8 deletions

View File

@ -4,12 +4,23 @@ mod errors;
use command::*;
use errors::*;
use clap::Parser;
use std::path::PathBuf;
use std::result;
pub type Result<T> = result::Result<T, Error>;
#[derive(Parser)]
pub struct Opt {
// TODO: transform this to "base" folder?
// XXX: use the directory/directory-next crate to get the "~/.config/sup" folder?
// ++ A config subFolder and execute in alphabetical order?
// + One config file? -> confy crate?
// - A master config file that list the sub/real files? no if it mean parsing 2 differents formats
//
// Default to something like -> "~/.config/system-updater/list.yml".into(),
//
//#[arg(default_value_t = PathBuf::from("examples/debian.yml"))]
pub config_file: PathBuf,
}

View File

@ -1,13 +1,8 @@
use clap::Parser;
use system_updater::*;
fn main() {
let opt = Opt {
// + One config file?
// + A config subFolder and execute in alphabetical order?
// - A master config file that list the sub/real files? no if it mean parsing 2 differents formats
//
// Hardcoded for now
config_file: "examples/openSUSE.yml".into(), // Default to something like -> "~/.config/system-updater/list.yml".into(),
};
let opt = Opt::parse();
run(&opt);
}