Beginnings of the list command

This commit is contained in:
Ian Wijma 2024-04-05 21:08:54 +11:00
parent c53513bccd
commit 4794bcb2ad
4 changed files with 23 additions and 4 deletions

15
src/commands/list.rs Normal file
View File

@ -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(())
}

View File

@ -1 +1,2 @@
pub mod run;
pub mod run;
pub mod list;

View File

@ -19,7 +19,7 @@ pub struct Arguments {
entry: String,
}
pub fn run (arguments: &Arguments) -> Result<(), String> {
pub fn execute (arguments: &Arguments) -> Result<(), String> {
let Arguments { entry, task_name } = arguments;
// Start the timer

View File

@ -1,13 +1,15 @@
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)
Run(run::Arguments),
List(list::Arguments),
}
#[derive(Parser, Debug)]
@ -21,7 +23,8 @@ fn main() {
let arguments = Arguments::parse();
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 {