2024-04-01 12:15:55 +00:00
|
|
|
use std::process::exit;
|
|
|
|
use clap::{Parser, Subcommand};
|
|
|
|
use commands::run;
|
2024-04-05 10:08:54 +00:00
|
|
|
use commands::list;
|
2024-04-01 12:15:55 +00:00
|
|
|
|
|
|
|
mod commands;
|
|
|
|
mod utils;
|
|
|
|
|
|
|
|
#[derive(Subcommand, Debug)]
|
|
|
|
enum Command {
|
2024-04-05 10:08:54 +00:00
|
|
|
Run(run::Arguments),
|
|
|
|
List(list::Arguments),
|
2024-04-01 12:15:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
#[command(author, version, about, long_about = None, propagate_version = true)]
|
|
|
|
struct Arguments {
|
|
|
|
#[command(subcommand)]
|
|
|
|
command: Command
|
|
|
|
}
|
|
|
|
|
2024-04-01 10:50:03 +00:00
|
|
|
fn main() {
|
2024-04-01 12:15:55 +00:00
|
|
|
let arguments = Arguments::parse();
|
|
|
|
|
|
|
|
let result = match &arguments.command {
|
2024-04-05 10:08:54 +00:00
|
|
|
Command::Run(arguments) => { run::execute(arguments) },
|
|
|
|
Command::List(arguments) => { list::execute(arguments) },
|
2024-04-01 12:15:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
match result {
|
|
|
|
Ok(_) => exit(0),
|
|
|
|
Err(err) => eprintln!("{}", err)
|
|
|
|
}
|
2024-04-01 10:50:03 +00:00
|
|
|
}
|