pace_rs/commands/settings/
get.rs

1use abscissa_core::{Application, Command, Runnable};
2use clap::{Parser, Subcommand};
3
4use crate::prelude::PACE_APP;
5
6/// `get` subcommand
7#[derive(Subcommand, Command, Debug, Runnable)]
8pub enum GetChoiceSubCmd {
9    /// Get the time zone
10    #[clap(visible_alias = "tz")]
11    Timezone(GetTimezoneSubCmd),
12}
13
14/// `get` subcommand for settings
15#[derive(Command, Debug, Parser, Runnable)]
16pub struct GetChoiceCmd {
17    #[clap(subcommand)]
18    commands: GetChoiceSubCmd,
19}
20
21/// Get the time zone
22#[derive(Command, Debug, Parser)]
23pub struct GetTimezoneSubCmd {}
24
25impl Runnable for GetTimezoneSubCmd {
26    fn run(&self) {
27        if let Some(time_zone) = PACE_APP.config().general().default_time_zone().as_ref() {
28            println!("{}", time_zone);
29        } else {
30            println!("No time zone set.");
31        };
32    }
33}