wip
This commit is contained in:
parent
61caed9ccd
commit
9c3349178e
10
src/main.rs
10
src/main.rs
|
@ -13,8 +13,16 @@ struct Cli {
|
||||||
#[derive(Subcommand, Debug, Clone)]
|
#[derive(Subcommand, Debug, Clone)]
|
||||||
enum Subcommands {
|
enum Subcommands {
|
||||||
Run {
|
Run {
|
||||||
|
/// Any number of filepaths to treat as inputs. They will be hashed and accesses to
|
||||||
|
/// equivalent files will be treated specially.
|
||||||
|
#[arg(short, long)]
|
||||||
|
input: Vec<PathBuf>,
|
||||||
|
|
||||||
|
/// The filepath to dump the json report to. will dump to stdout if unspecified.
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
output: Option<PathBuf>,
|
output: Option<PathBuf>,
|
||||||
|
|
||||||
|
/// The command to run. Have fun!
|
||||||
cmd: Vec<String>,
|
cmd: Vec<String>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +31,7 @@ fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
match cli.cmd {
|
match cli.cmd {
|
||||||
Subcommands::Run { output, cmd } => {
|
Subcommands::Run { input, output, cmd } => {
|
||||||
let fp: Box<dyn std::io::Write> = if let Some(output) = &output {
|
let fp: Box<dyn std::io::Write> = if let Some(output) = &output {
|
||||||
Box::new(std::fs::File::options().write(true).create(true).open(output).unwrap())
|
Box::new(std::fs::File::options().write(true).create(true).open(output).unwrap())
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue