Adding automatic IP address, some refactor and better texts. Upgrading version.

This commit is contained in:
2023-05-23 01:17:03 +02:00
parent 3bd55576ce
commit 01ac2ca7b7
12 changed files with 496 additions and 149 deletions
+33 -12
View File
@@ -6,29 +6,50 @@ use structopt::StructOpt;
about = "CLI to extract meteorology data from Open Meteo"
)]
pub enum Arguments {
#[structopt(about = "Gets the current weather for a coordinate")]
#[structopt(
about = "Displays the current weather for your IP address automatically or for specific coordinates"
)]
CurrentWeather {
#[structopt(short = "l", long, help = "Latitude as a decimal number")]
latitude: f32,
#[structopt(short = "L", long, help = "Longitude as a decimal number")]
longitude: f32,
#[structopt(
short = "l",
long,
requires("longitude"),
help = "Latitude as a decimal number"
)]
latitude: Option<f64>,
#[structopt(
short = "L",
long,
requires("latitude"),
help = "Longitude as a decimal number"
)]
longitude: Option<f64>,
// Flags
#[structopt(short = "a", long, help = "Prints all the parameters")]
#[structopt(short = "a", long, help = "Displays all the information")]
all: bool,
#[structopt(short = "d", long, help = "Prints if it's day or night")]
#[structopt(short = "d", long, help = "Displays if it's day or night")]
is_day: bool,
#[structopt(short = "t", long, help = "Prints the decimal temperature")]
#[structopt(
short = "t",
long,
help = "Displays the decimal temperature, in Celsius"
)]
temperature: bool,
#[structopt(short = "w", long, help = "Prints the decimal wind speed")]
#[structopt(short = "w", long, help = "Displays the decimal wind speed, in km/h")]
windspeed: bool,
#[structopt(short = "W", long, help = "Prints the wind direction angle")]
#[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(
short = "c",
long,
help = "Cleans the output and only shows the values separated by commas.
- ORDER: is_day, temperature, windspeed, winddirection"
help = "Cleans the output and only displays the values separated by commas.
- ORDER: latitude, longitude, city, is_day, temperature, windspeed, winddirection"
)]
clean: bool,
},