Add the option to treat minutes and hours flags as discounting from an 8 hr day
This commit is contained in:
parent
27b9345377
commit
7a6aa2489b
4 changed files with 11 additions and 3 deletions
|
|
@ -11,4 +11,8 @@ pub struct Args {
|
|||
/// How many minutes you intend to work (sums with `hours`)
|
||||
#[arg(long, default_value_t = 0)]
|
||||
pub minutes: i64,
|
||||
|
||||
/// If true, the the hours and minutes fields are treated as subtracting from 8 hours
|
||||
#[arg(long, default_value_t = false)]
|
||||
pub discount: bool,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@ fn main() -> Result<()> {
|
|||
total_minutes += (now - remaining).num_minutes();
|
||||
}
|
||||
|
||||
let target_minutes = args.hours * 60 + args.minutes;
|
||||
let target_minutes = if args.discount {
|
||||
(8 * 60) - (args.hours * 60 + args.minutes)
|
||||
} else {
|
||||
args.hours * 60 + args.minutes
|
||||
};
|
||||
println!("{}", time::get_charaterized_time_remaining(total_minutes, target_minutes));
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue