running-tasks/src/main.rs

35 lines
725 B
Rust

use std::process::exit;
use clap::{Parser, Subcommand};
use commands::run;
use commands::list;
mod commands;
mod utils;
#[derive(Subcommand, Debug)]
enum Command {
Run(run::Arguments),
List(list::Arguments),
}
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None, propagate_version = true)]
struct Arguments {
#[command(subcommand)]
command: Command
}
fn main() {
let arguments = Arguments::parse();
let result = match &arguments.command {
Command::Run(arguments) => { run::execute(arguments) },
Command::List(arguments) => { list::execute(arguments) },
};
match result {
Ok(_) => exit(0),
Err(err) => eprintln!("{}", err)
}
}