From 9e3b0ac72f6b50505827d82b152576c998d9bcec Mon Sep 17 00:00:00 2001 From: hesam-init Date: Fri, 29 Mar 2024 03:31:45 +0330 Subject: [PATCH] feat: set timezone function --- configs/shell/zsh/.zsh/functions/main.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/configs/shell/zsh/.zsh/functions/main.zsh b/configs/shell/zsh/.zsh/functions/main.zsh index 8dbcae7..e74d3e1 100644 --- a/configs/shell/zsh/.zsh/functions/main.zsh +++ b/configs/shell/zsh/.zsh/functions/main.zsh @@ -10,6 +10,24 @@ convert_video_to_gif() { echo "GIF created: $output_filename" } +set_timezone() { + local timezone="" + local timezones_path="/usr/share/zoneinfo" + + echo "Select a timezone:" + select tz_option in $timezones_path/*; do + if [[ -e $tz_option ]]; then + timezone="${tz_option##*/}" + break + else + echo "Invalid option. Please select a valid timezone." + fi + done + + sudo ln -sf "$tz_option" "/etc/localtime" + echo "Timezone set to $timezone" +} + extract() { params_required "File" "Usage: extract [path/compressed_filename]" "$1"