40 lines
1.0 KiB
Rust
40 lines
1.0 KiB
Rust
mod command;
|
|
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,
|
|
|
|
#[arg(short, long)]
|
|
pub yes: bool,
|
|
|
|
#[arg(short, long)]
|
|
pub quiet: bool,
|
|
#[arg(short, long)]
|
|
pub steps: Option<Vec<String>>,
|
|
}
|
|
|
|
pub fn run(opt: &Opt) {
|
|
let updater = Updater::from_config(opt).unwrap();
|
|
|
|
updater.update_all(opt).unwrap();
|
|
}
|