我最初编写这段代码是为了提供示例,然后是为了我自己,然后是为了我的朋友。
我本来没打算发布它,但它确实很有用。
OVERVIEW:
Check the time at a given location, "now Sao Paolo Brazil". Locations
are diacritical and case insensitive. Use postcodes, cities, states,
countries, even place names like "now Lincoln Memorial"
When it's this time here: "now --local 5PM Bath UK"
When it's that time there: "now --remote 5PM Bath UK"
Valid time styles: 5PM, 5:30PM, 17:30, 1730. (No spaces.)
USAGE: now [--local <local>] [--remote <remote>] [<location-info> ...]
ARGUMENTS:
<location-info>
OPTIONS:
-@, -l, --at, --here, --local <local>
When it's this local time
-r, --when, --there, --remote <remote>
When it's this remote time
-h, --help Show help information.
% now sao paolo brazil
São Paulo 3:50:58 PM (GMT-3 Brasilia Standard Time)
% now --local 4PM sao paolo brazil
São Paulo 9:00:00 PM (GMT-3 Brasilia Standard Time)
% now --remote 4PM sao paolo brazil
Local 1:00:00 PM (GMT-3 Brasilia Standard Time)
注意:已提交错误报告,因为帮助信息显示的是 when
而不是 remote
作为远程时间的值。
swift build
。 构建好的实用程序可以在 .build/debug/now
中找到。使用 swift run
运行我刚开始添加这个部分,所以如果您参与了但我不小心忘记提及您,请告诉我,我会更新!
Darren Ford (代码审查),Ryan Booker (代码审查和改进,以及 Paul Hudson (住在错误的时区))
我想添加测试,使其无论实用程序在哪里构建和测试都能工作。(我现在在 Xcode 之外进行所有测试。)
如果您有任何建议或指导,请告诉我。 谢谢!