pub mod commands;
use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(name = "saga", version, about = "Time tracking from the terminal")]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Tui,
Start {
project: String,
#[arg(short, long)]
description: Option<String>,
#[arg(short, long)]
tag: Vec<String>,
#[arg(long)]
no_billable: bool,
},
Stop {
#[arg(short, long)]
description: Option<String>,
},
Status,
Cancel,
Resume,
Add {
#[arg(short, long)]
project: String,
#[arg(short, long)]
start: String,
#[arg(short, long)]
end: String,
#[arg(short, long)]
description: Option<String>,
#[arg(short, long)]
tag: Vec<String>,
},
Log {
#[arg(long)]
today: bool,
#[arg(long)]
week: bool,
#[arg(long)]
month: bool,
#[arg(long)]
project: Option<String>,
#[arg(long)]
client: Option<String>,
},
Report {
#[arg(long, default_value = "weekly")]
period: String,
#[arg(long, default_value = "table")]
format: String,
#[arg(short, long)]
output: Option<String>,
},
Projects {
#[command(subcommand)]
action: ProjectAction,
},
Clients {
#[command(subcommand)]
action: ClientAction,
},
Tags {
#[command(subcommand)]
action: TagAction,
},
Rates {
#[command(subcommand)]
action: RateAction,
},
Invoice {
#[command(subcommand)]
action: InvoiceAction,
},
Config {
#[command(subcommand)]
action: ConfigAction,
},
}
#[derive(Subcommand, Debug)]
pub enum ProjectAction {
List {
#[arg(long)]
all: bool,
},
Add {
name: String,
#[arg(short, long)]
client: Option<String>,
#[arg(long)]
color: Option<String>,
#[arg(short, long)]
budget: Option<f64>,
},
Edit {
name: String,
#[arg(long)]
new_name: Option<String>,
#[arg(long)]
color: Option<String>,
#[arg(long)]
budget: Option<f64>,
},
Archive {
name: String,
},
Activate {
name: String,
},
}
#[derive(Subcommand, Debug)]
pub enum ClientAction {
List,
Add {
name: String,
#[arg(long)]
contact: Option<String>,
#[arg(long)]
email: Option<String>,
},
Edit {
name: String,
#[arg(long)]
new_name: Option<String>,
#[arg(long)]
contact: Option<String>,
#[arg(long)]
email: Option<String>,
},
Delete {
name: String,
},
}
#[derive(Subcommand, Debug)]
pub enum TagAction {
List,
Add {
name: String,
#[arg(long)]
color: Option<String>,
},
Delete {
name: String,
},
}
#[derive(Subcommand, Debug)]
pub enum RateAction {
Set {
rate: f64,
#[arg(long)]
project: Option<String>,
#[arg(long)]
client: Option<String>,
#[arg(long, default_value = "USD")]
currency: String,
},
List,
}
#[derive(Subcommand, Debug)]
pub enum InvoiceAction {
Generate {
#[arg(short, long)]
client: String,
#[arg(short, long)]
from: String,
#[arg(short, long)]
to: String,
#[arg(short, long)]
output: Option<String>,
},
List,
}
#[derive(Subcommand, Debug)]
pub enum ConfigAction {
Show,
Set {
key: String,
value: String,
},
Path,
}