mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
timezone: Add an option to list all time zones
This commit is contained in:
parent
4a8a3df975
commit
40147c48be
1 changed files with 8 additions and 0 deletions
|
@ -18,11 +18,19 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
StringView time_zone;
|
StringView time_zone;
|
||||||
|
bool list_time_zones = false;
|
||||||
|
|
||||||
Core::ArgsParser args_parser;
|
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.add_positional_argument(time_zone, "The time zone to set", "time-zone", Core::ArgsParser::Required::No);
|
||||||
args_parser.parse(arguments);
|
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()) {
|
if (time_zone.is_empty()) {
|
||||||
outln("{}", TimeZone::current_time_zone());
|
outln("{}", TimeZone::current_time_zone());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue