Get config_file from command args
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@ -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,
|
||||
}
|
||||
|
||||
|
11
src/main.rs
11
src/main.rs
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user