use std::error::Error;
use super::Command;
use crate::weather_api::{Client, Location};
use clap::Parser;
#[derive(Parser, Debug)]
pub struct LocationCommand {
#[clap()]
location: String,
}
impl LocationCommand {
pub fn run(&self, command: &Command) -> Result<(), Box<dyn Error>> {
let client = Client::new().login(command.key.clone());
let location = Location::from_string(&client, &self.location)?;
println!("{}", location);
Ok(())
}
}