Last active
January 10, 2022 23:13
-
-
Save jasonrhodes/c649b679f2ac7ff176dd9c0b06fa5413 to your computer and use it in GitHub Desktop.
Manage your Mac OS X timezone like, super easy and stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
get() { | |
sudo systemsetup -gettimezone | |
} | |
set() { | |
sudo systemsetup -settimezone $1 | |
} | |
list() { | |
sudo systemsetup -listtimezones | |
} | |
search() { | |
list | grep -i $1 | |
} | |
printCurrentTime() { | |
echo "Current Time: $(node -p 'new Date().toString()')" | |
} | |
if [[ $1 == 'get' ]]; then | |
get | |
printCurrentTime | |
exit 0 | |
fi | |
if [[ $1 == 'set' ]]; then | |
set $2 | |
printCurrentTime | |
exit 0 | |
fi | |
if [[ $1 == 'list' ]]; then | |
list | |
exit 0 | |
fi | |
if [[ $1 == 'search' ]]; then | |
search $2 | |
exit 0 | |
fi | |
echo """ | |
Usage: | |
timezone get get current timezone | |
timezone set TIMEZONE sets current timezone to valid TIMEZONE | |
timezone list lists valid timezone strings | |
timezone search SUBSTRING searches valid timezones for given SUBSTRING | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment