mirror of
https://github.com/lov3b/ecb-rates.git
synced 2025-02-22 09:50:10 +01:00
invert option
This commit is contained in:
parent
4445685444
commit
d842fb786c
@ -37,6 +37,10 @@ pub struct Cli {
|
||||
#[arg(long = "perspective", short = 'p')]
|
||||
pub perspective: Option<String>,
|
||||
|
||||
/// Invert the rate
|
||||
#[arg(long = "invert", short = 'i')]
|
||||
pub should_invert: bool,
|
||||
|
||||
/// Amount of data
|
||||
#[arg(value_enum, default_value_t = Resolution::TODAY, long="resolution", short='r')]
|
||||
pub resolution: Resolution,
|
||||
|
@ -7,7 +7,7 @@ use ecb_rates::cli::{Cli, FormatOption};
|
||||
use ecb_rates::models::ExchangeRateResult;
|
||||
use ecb_rates::parsing::parse;
|
||||
use ecb_rates::table::{TableRef, TableTrait as _};
|
||||
use ecb_rates::utils_calc::{change_perspective, filter_currencies};
|
||||
use ecb_rates::utils_calc::{change_perspective, filter_currencies, invert_rates};
|
||||
|
||||
async fn get_and_parse(url: impl IntoUrl) -> anyhow::Result<Vec<ExchangeRateResult>> {
|
||||
let client = Client::new();
|
||||
@ -80,6 +80,10 @@ async fn main() -> ExitCode {
|
||||
}
|
||||
}
|
||||
|
||||
if cli.should_invert {
|
||||
invert_rates(&mut parsed);
|
||||
}
|
||||
|
||||
if !cli.currencies.is_empty() {
|
||||
let currencies = cli
|
||||
.currencies
|
||||
|
Loading…
x
Reference in New Issue
Block a user