Beginnings of the list command
This commit is contained in:
parent
c53513bccd
commit
4794bcb2ad
|
@ -0,0 +1,15 @@
|
||||||
|
use clap::Args;
|
||||||
|
|
||||||
|
#[derive(Args, Debug)]
|
||||||
|
pub struct Arguments {
|
||||||
|
#[arg(long, default_value = ".", help = "Which directory to use as entry, defaults to the current directory")]
|
||||||
|
entry: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute (arguments: &Arguments) -> Result<(), String> {
|
||||||
|
let Arguments { entry } = arguments;
|
||||||
|
|
||||||
|
eprintln!("entry = {:?}", entry);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
pub mod run;
|
pub mod run;
|
||||||
|
pub mod list;
|
|
@ -19,7 +19,7 @@ pub struct Arguments {
|
||||||
entry: String,
|
entry: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run (arguments: &Arguments) -> Result<(), String> {
|
pub fn execute (arguments: &Arguments) -> Result<(), String> {
|
||||||
let Arguments { entry, task_name } = arguments;
|
let Arguments { entry, task_name } = arguments;
|
||||||
|
|
||||||
// Start the timer
|
// Start the timer
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use commands::run;
|
use commands::run;
|
||||||
|
use commands::list;
|
||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
enum Command {
|
enum Command {
|
||||||
Run(run::Arguments)
|
Run(run::Arguments),
|
||||||
|
List(list::Arguments),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
@ -21,7 +23,8 @@ fn main() {
|
||||||
let arguments = Arguments::parse();
|
let arguments = Arguments::parse();
|
||||||
|
|
||||||
let result = match &arguments.command {
|
let result = match &arguments.command {
|
||||||
Command::Run(arguments) => { run::run(arguments) }
|
Command::Run(arguments) => { run::execute(arguments) },
|
||||||
|
Command::List(arguments) => { list::execute(arguments) },
|
||||||
};
|
};
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
|
|
Loading…
Reference in New Issue