Skip to content

Commit

Permalink
add today to report
Browse files Browse the repository at this point in the history
  • Loading branch information
bck01215 committed Jul 10, 2024
1 parent 818cfa4 commit 52fabf7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "elasticnow"
version = "0.4.1"
version = "0.4.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Options:
| `-u, --user <USER>` | Override the default user in the report |
| `--since <SINCE>` | Start date of search (defaults to 2024-06-24) |
| `--until <UNTIL>` | End date of search (defaults to 2024-06-26) |
| `-T, --today` | Set since to today |
| `-t, --top <TOP>` | Limit the number of cost centers returned in the report. Any extra fields will be grouped into other [default: 10]|
| `-h, --help` | Print help |

Expand Down
4 changes: 4 additions & 0 deletions src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ pub enum Commands {
#[clap(long, help = format!("End date of search (defaults to {})", get_today()))]
until: Option<String>,

#[clap(short='T', long, action = clap::ArgAction::SetTrue)]
/// Set since to today
today: bool,

#[clap(short, long, default_value = "10")]
/// Limit the number of cost centers returned in the report. Any extra fields will be grouped into other
top: Option<usize>,
Expand Down
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ async fn main() {

Some(cli::args::Commands::Report {
user,
since,
mut since,
until,
top,
today,
}) => {
if today {
since = Some(args::get_today());
}
run_report(user, since, until, top).await;
}
_ => {
Expand Down

0 comments on commit 52fabf7

Please sign in to comment.