mirror of
https://github.com/lov3b/ecb-rates.git
synced 2025-02-22 18:00:11 +01:00
force color
This commit is contained in:
parent
dde5468e2b
commit
ca846c390f
@ -25,6 +25,10 @@ pub struct Cli {
|
||||
#[arg(long = "no-cache")]
|
||||
pub no_cache: bool,
|
||||
|
||||
/// Force color in output. Normally it will disable color in pipes
|
||||
#[arg(long = "force-color")]
|
||||
pub force_color: bool,
|
||||
|
||||
/// Amount of data
|
||||
#[arg(value_enum, default_value_t = Resolution::TODAY, long="resolution", short='r')]
|
||||
pub resolution: Resolution,
|
||||
|
@ -35,6 +35,10 @@ fn filter_currencies(exchange_rate_results: &mut [ExchangeRateResult], currencie
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> ExitCode {
|
||||
let cli = Cli::parse();
|
||||
if cli.force_color {
|
||||
colored::control::set_override(true);
|
||||
}
|
||||
|
||||
let use_cache = !cli.no_cache;
|
||||
let cache = if use_cache { Cache::load() } else { None };
|
||||
let cache_ok = cache.as_ref().map_or_else(|| false, |c| c.validate());
|
||||
|
Loading…
x
Reference in New Issue
Block a user