diff --git a/Cargo.lock b/Cargo.lock index 4c9cb08..9bc8192 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -663,6 +663,7 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" name = "lichen_cli" version = "0.1.0" dependencies = [ + "chrono-tz", "color-eyre", "console", "dialoguer", diff --git a/lichen_cli/Cargo.toml b/lichen_cli/Cargo.toml index 7435020..7b2d418 100644 --- a/lichen_cli/Cargo.toml +++ b/lichen_cli/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] color-eyre.workspace = true +chrono-tz.workspace = true dialoguer = { version = "0.11.0", features = ["completion", "fuzzy-matcher", "fuzzy-select"] } indicatif = "0.17.8" futures.workspace = true diff --git a/lichen_cli/src/main.rs b/lichen_cli/src/main.rs index 7e3a986..d1af62a 100644 --- a/lichen_cli/src/main.rs +++ b/lichen_cli/src/main.rs @@ -72,6 +72,20 @@ fn ask_disk(disks: &[Disk]) -> color_eyre::Result<&Disk> { Ok(&disks[index]) } +fn ask_timezone() -> color_eyre::Result { + print_header("🕒", "Now we need to set the system timezone"); + + let index = dialoguer::FuzzySelect::with_theme(&ColorfulTheme::default()) + .with_prompt("Start typing") + .items(&chrono_tz::TZ_VARIANTS) + .default(0) + .highlight_matches(true) + .max_length(10) + .interact()?; + + Ok(chrono_tz::TZ_VARIANTS[index].to_string()) +} + #[tokio::main] async fn main() -> color_eyre::Result<()> { color_eyre::install().unwrap(); @@ -85,11 +99,13 @@ async fn main() -> color_eyre::Result<()> { let selected_disk = ask_disk(&disks)?; let selected_locale = ask_locale(&locales).await?; + let timezone = ask_timezone()?; let _ = ask_password()?; print_header("🕮", "Quickly review your settings"); print_summary_item("Disk", selected_disk); print_summary_item("Locale", selected_locale); + print_summary_item("Timezone", &timezone); println!("\n\n");