Adding SpeedUnit and TempUnit

This commit is contained in:
2023-06-08 23:10:21 +02:00
parent 09df3cc6ed
commit cd04da0d91
9 changed files with 184 additions and 46 deletions
+12 -6
View File
@@ -1,5 +1,7 @@
use structopt::StructOpt;
use crate::{temp_unit::TempUnit, speed_unit::SpeedUnit};
#[derive(Debug, StructOpt)]
#[structopt(
name = "open-meteo-cli",
@@ -30,14 +32,18 @@ pub enum Arguments {
all: bool,
#[structopt(short = "d", long, help = "Displays if it's day or night")]
is_day: bool,
#[structopt(
short = "t",
long,
help = "Displays the decimal temperature, in Celsius"
)]
#[structopt(short = "t", long, help = "Displays the decimal temperature")]
temperature: bool,
#[structopt(short = "w", long, help = "Displays the decimal wind speed, in km/h")]
#[structopt(long,
possible_values = &TempUnit::variants(), default_value = "Celsius" , case_insensitive = true,
help = "Switches between Celsius or Fahrenheit")]
temperature_unit: TempUnit,
#[structopt(short = "w", long, help = "Displays the decimal wind speed")]
windspeed: bool,
#[structopt(long,
possible_values = &SpeedUnit::variants(), default_value = "Kmh" , case_insensitive = true,
help = "Switches between km/h, m/s, mp/h or knots")]
speed_unit: SpeedUnit,
#[structopt(short = "W", long, help = "Displays the wind direction, in degrees")]
winddirection: bool,
#[structopt(long = "coords", help = "Displays the latitude and the longitude")]