use structopt::StructOpt; use crate::{ formats::data_format::DataFormat, formats::speed_unit::SpeedUnit, formats::temp_unit::TempUnit, }; #[derive(Debug, StructOpt)] #[structopt( name = "open-meteo-cli", about = "CLI to extract meteorology data from Open Meteo" )] pub enum Arguments { #[structopt( about = "Displays the current weather for your IP address automatically or for specific coordinates" )] CurrentWeather { #[structopt( short = "l", long, requires("longitude"), help = "Latitude as a decimal number" )] latitude: Option, #[structopt( short = "L", long, requires("latitude"), help = "Longitude as a decimal number" )] longitude: Option, // Flags #[structopt(short = "a", long, help = "Displays all the information")] all: bool, #[structopt(short = "d", long, help = "Displays if it is day or night")] is_day: bool, #[structopt(short = "t", long, help = "Displays the decimal temperature")] temperature: bool, #[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")] include_coords: bool, #[structopt(long = "city", help = "Displays the city")] include_city: bool, #[structopt(long, possible_values = &DataFormat::variants(), default_value = "Normal" , case_insensitive = true, help = "Switches data format between Normal, Clean or JSON")] format: DataFormat, #[structopt( short = "c", long, help = "Displays the output separated by commas. Same as '--format clean' - ORDER: latitude, longitude, city, is_day, temperature, windspeed, winddirection" )] clean: bool, #[structopt( short = "j", long, help = "Displays the output as JSON. Same as '--format json'" )] json: bool, }, }