diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-01-24 07:47:08 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-25 18:39:36 +0000 |
commit | 40147c48be977b54259bf0434f2d6417ae17b1b5 (patch) | |
tree | 1d94ea4bc5f42689770258eea4f06ea346e5ba05 /Userland | |
parent | 4a8a3df97505174080bc31601c97a3491856187a (diff) | |
download | serenity-40147c48be977b54259bf0434f2d6417ae17b1b5.zip |
timezone: Add an option to list all time zones
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Utilities/timezone.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Utilities/timezone.cpp b/Userland/Utilities/timezone.cpp index 3c2c008c26..641d8ef548 100644 --- a/Userland/Utilities/timezone.cpp +++ b/Userland/Utilities/timezone.cpp @@ -18,11 +18,19 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil(nullptr, nullptr)); StringView time_zone; + bool list_time_zones = false; Core::ArgsParser args_parser; + args_parser.add_option(list_time_zones, "List all available time zones", "list-time-zones", 'l'); args_parser.add_positional_argument(time_zone, "The time zone to set", "time-zone", Core::ArgsParser::Required::No); args_parser.parse(arguments); + if (list_time_zones) { + for (auto time_zone : TimeZone::all_time_zones()) + outln("{}", time_zone); + return 0; + } + if (time_zone.is_empty()) { outln("{}", TimeZone::current_time_zone()); return 0; |