mirror of
https://github.com/lov3b/ecb-rates.git
synced 2025-02-22 18:00:11 +01:00
Rename project
This commit is contained in:
parent
272c5d15c8
commit
3d9b99521b
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -212,7 +212,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ecb-exchange"
|
name = "ecb-rates"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ecb-exchange"
|
name = "ecb-rates"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
use clap::Parser as _;
|
use clap::Parser as _;
|
||||||
use ecb_exchange::{cli::Cli, models::ExchangeRateResult};
|
|
||||||
use reqwest::{Client, IntoUrl};
|
use reqwest::{Client, IntoUrl};
|
||||||
use std::{borrow::BorrowMut, collections::HashMap, error::Error, process::ExitCode};
|
use std::{borrow::BorrowMut, collections::HashMap, error::Error, process::ExitCode};
|
||||||
|
|
||||||
use ecb_exchange::parsing::parse;
|
use ecb_rates::cli::{Cli, FormatOption};
|
||||||
|
use ecb_rates::models::ExchangeRateResult;
|
||||||
|
use ecb_rates::parsing::parse;
|
||||||
|
|
||||||
async fn get_and_parse(url: impl IntoUrl) -> Result<Vec<ExchangeRateResult>, Box<dyn Error>> {
|
async fn get_and_parse(url: impl IntoUrl) -> Result<Vec<ExchangeRateResult>, Box<dyn Error>> {
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
@ -42,7 +43,7 @@ async fn main() -> ExitCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let output = match cli.command {
|
let output = match cli.command {
|
||||||
ecb_exchange::cli::FormatOption::Json => {
|
FormatOption::Json => {
|
||||||
let mut json_values = parsed
|
let mut json_values = parsed
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| serde_json::to_value(x).expect("Failed to parse content as JSON value"))
|
.map(|x| serde_json::to_value(x).expect("Failed to parse content as JSON value"))
|
||||||
@ -63,7 +64,7 @@ async fn main() -> ExitCode {
|
|||||||
}
|
}
|
||||||
.expect("Failed to parse content as JSON")
|
.expect("Failed to parse content as JSON")
|
||||||
}
|
}
|
||||||
ecb_exchange::cli::FormatOption::Plain => {
|
FormatOption::Plain => {
|
||||||
struct StringCur<'a> {
|
struct StringCur<'a> {
|
||||||
time: &'a String,
|
time: &'a String,
|
||||||
cur: String,
|
cur: String,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user