Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dオプションが動作しません #13

Closed
wakamatsu-yui opened this issue Aug 11, 2020 · 2 comments
Closed

dオプションが動作しません #13

wakamatsu-yui opened this issue Aug 11, 2020 · 2 comments

Comments

@wakamatsu-yui
Copy link

最新バージョンと思われるv0.3.0をダウンロードして試しました。

➜  ~ ./instant --version
instant version v0.3.0
Build OS: Mac OS X, 10.15.5, x86_64
With JVM: 11.0.6(Oracle Corporation Substrate VM GraalVM 20.0.0 CE)
Powered by Picocli 4.2.0

READMEにある、日付指定の -d オプションが利用できませんでした。
サポート外でしょうか。

➜  ~ ./instant -d 2020-08-11
Unknown options: '-d', '2020-08-11'
Usage: instant [-hV] [-a=<duration>] [-f=<format>] [-z=<timeZone>]
  -a, --add, --add-duration=<duration>
                          Add duration to instant. The format is 'PnDTnHnMn.nS'.
                          The 'P' is fixed char.
                          The 'nD' means days.
                          The 'T' is fixed char required if inputting times.
                          The 'nH' means hours.
                          The 'nM' means minutes.
                          The 'n.nS' means seconds and fractional seconds. The
                            fractional seconds is optional.
                          default: ''(empty)
  -f, --format=<format>   Specifies output format. Available values are 'unix'
                            or DateTimeFormatter pattern. default:
                            uuuu-MM-dd'T'HH:mm:ss.nX
  -h, --help              Show this help message and exit.
  -V, --version           Print version information and exit.
  -z, --zone, --time-zone=<timeZone>
                          Specifies time-zone to show the time of instant.
                          Available values are integer(difference from UTC in
                            hours), zone ids(like PST8PDT, Asia/Tokyo).
                          default: null

確かにusageには出てきませんでした。

➜  ~ ./instant --help
Usage: instant [-hV] [-a=<duration>] [-f=<format>] [-z=<timeZone>]
  -a, --add, --add-duration=<duration>
                          Add duration to instant. The format is 'PnDTnHnMn.nS'.
                          The 'P' is fixed char.
                          The 'nD' means days.
                          The 'T' is fixed char required if inputting times.
                          The 'nH' means hours.
                          The 'nM' means minutes.
                          The 'n.nS' means seconds and fractional seconds. The
                            fractional seconds is optional.
                          default: ''(empty)
  -f, --format=<format>   Specifies output format. Available values are 'unix'
                            or DateTimeFormatter pattern. default:
                            uuuu-MM-dd'T'HH:mm:ss.nX
  -h, --help              Show this help message and exit.
  -V, --version           Print version information and exit.
  -z, --zone, --time-zone=<timeZone>
                          Specifies time-zone to show the time of instant.
                          Available values are integer(difference from UTC in
                            hours), zone ids(like PST8PDT, Asia/Tokyo).
                          default: null

もし利用法間違ってたらご指摘ください。

@mike-neck
Copy link
Owner

mike-neck commented Aug 11, 2020

Sorry for the wrong documentation, it's not supported. For the reason please read #2 .
Instead of using -d, you can run instant in conjunction with duration.

For example if you want to get unix time of 2020-08-11T00:00:00+09:00, run the command listed as bellow.

instant -f unix -a $(duration '2020-08-11T00:00:00+09:00')

The duration prints an ISO-8601 format string calculated with duration between now and input date time.(Duration requires fully ISO-8601 format date time and zone offset).

@wakamatsu-yui
Copy link
Author

Thank you for the solution.
I'll use duration expression instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants