Skip to content

Commit

Permalink
deps: bump clap to 4.0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusZoppelt committed Nov 8, 2022
1 parent d086b62 commit 4ade7fa
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 86 deletions.
115 changes: 36 additions & 79 deletions 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
Expand Up @@ -2,7 +2,7 @@
name = "portfolio_rs"
description = "A command line tool for managing financial investment portfolios written in Rust."
readme = "README.md"
version = "0.1.2"
version = "0.1.3"
edition = "2021"
license = "MIT"

Expand Down
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use colored::*;
mod portfolio;
mod position;

fn cli() -> Command<'static> {
fn cli() -> Command {
Command::new("portfolio_rs")
.about("A simple portfolio tool")
.author("Markus Zoppelt")
Expand Down Expand Up @@ -69,21 +69,21 @@ async fn main() {
let matches = cli().get_matches();

if let Some(matches) = matches.subcommand_matches("balances") {
let filename = matches.value_of("FILE").expect("Cannot read file");
let filename = matches.get_one::<String>("FILE").expect("Cannot get filename");
let portfolio = create_live_portfolio(filename).await;
portfolio.print(true);
store_balance_in_db(&portfolio);
}

if let Some(matches) = matches.subcommand_matches("allocation") {
let filename = matches.value_of("FILE").expect("Cannot read file");
let filename = matches.get_one::<String>("FILE").expect("Cannot get filename");
let portfolio = create_live_portfolio(filename).await;
portfolio.draw_pie_chart();
portfolio.print_allocation();
}

if let Some(matches) = matches.subcommand_matches("performance") {
let filename = matches.value_of("FILE").expect("Cannot read file");
let filename = matches.get_one::<String>("FILE").expect("Cannot get filename");
let portfolio = create_live_portfolio(filename).await;
let db = sled::open("database").unwrap();

Expand Down Expand Up @@ -138,8 +138,8 @@ mod tests {
#[test]
fn test_cli() {
let matches =
cli().get_matches_from_safe(vec!["portfolio_rs", "balances", "example_data.json"]);
assert!(matches.is_ok());
cli().get_matches_from(vec!["portfolio_rs", "balances", "example_data.json"]);
assert_eq!(matches.subcommand_name(), Some("balances"));
}

#[tokio::test]
Expand Down

0 comments on commit 4ade7fa

Please sign in to comment.