Documentation
¶
Overview ¶
Package duration reads and writes the durations of the CLI. A flag that takes a duration accepts a day unit, as in "30d", because policy durations such as a trust expiry are in days. The time package has no day unit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format writes a duration that Parse reads back to the same value. It drops zero minutes and seconds, so 48 hours is "48h", not "48h0m0s". Tables use dry/tui/humanize instead.
func Parse ¶
Parse reads a duration as time.ParseDuration does, and also accepts a leading day unit: "30d", "1d12h". A day is 24 hours.
func Window ¶
func Window(since, until time.Duration, now time.Time, noun string) (after, before *time.Time, err error)
Window turns the --since and --until flags of a list command into a time range. Both are durations before now, and zero means no bound. after is nil when since is zero, and before is nil when until is zero. More than one list command reads these flags, so they all refuse the same input with the same message. noun names the listed items in the help, as "events".