57 lines
1.8 KiB
Rust
57 lines
1.8 KiB
Rust
use structopt::StructOpt;
|
|
|
|
#[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<f64>,
|
|
#[structopt(
|
|
short = "L",
|
|
long,
|
|
requires("latitude"),
|
|
help = "Longitude as a decimal number"
|
|
)]
|
|
longitude: Option<f64>,
|
|
|
|
// Flags
|
|
#[structopt(short = "a", long, help = "Displays all the information")]
|
|
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"
|
|
)]
|
|
temperature: bool,
|
|
#[structopt(short = "w", long, help = "Displays the decimal wind speed, in km/h")]
|
|
windspeed: bool,
|
|
#[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 displays the values separated by commas.
|
|
- ORDER: latitude, longitude, city, is_day, temperature, windspeed, winddirection"
|
|
)]
|
|
clean: bool,
|
|
},
|
|
}
|