From a361eb833f516befe79b45a8b6ed3162a21bc06a Mon Sep 17 00:00:00 2001 From: jvech Date: Sun, 28 Apr 2024 22:53:50 -0500 Subject: add: view subcommand implemented --- src/cli.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs index 0bd0a78..38ac648 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -3,7 +3,7 @@ use clap::{Subcommand, Parser, ValueHint}; use std::env; #[derive(Debug, Parser)] -#[command(version, about, long_about = None)] +#[command(version, about = "A simple debt manager", long_about = None)] pub struct Cli { /// file path where data is stored [default: /// $XDG_DATA_HOME/debt/debt.db @@ -24,7 +24,7 @@ pub enum Commands { person: String, /// amount of money - amount: i32, + amount: u32, /// additional notes note: Option, @@ -34,13 +34,15 @@ pub enum Commands { payment: bool }, + /// View Registered data View { + /// Filter history data (only works with -H) filter: Option, /// View register history - #[arg(short='H', long)] + #[arg(short='H', long, conflicts_with = "total")] history: bool, /// Transaction accumulation by person - #[arg(short, long)] + #[arg(short, long, conflicts_with = "history")] total: bool }, @@ -70,7 +72,7 @@ fn load_datapath(cli: &mut Cli) { }) }).or_else(|| { if let Ok(home) = env::var("HOME") { - let fallback = PathBuf::from(&home).join(".debt.db"); + let fallback = PathBuf::from(&home).join(".cache.db"); if fallback.exists() { return Some(fallback) } -- cgit v1.2.3-70-g09d2