feat(cli): extend duration to longer units (#15040)

This PR is a proposal to improve the situation described in #14750 

For some precise commands - we would like to be able to use durations
bigger than hours, minutes..

This PR extends the Duration proposed by Go with : 
- `d` - a day or 24hours.
- `y` - a year or 365 days.

I also removed the default value for lifetime and instead fetch the
maxLifetime value from codersdk - so by default if no value set we use
the value defined in the config.
This commit is contained in:
Vincent Vielle
2024-10-16 17:02:56 +02:00
committed by GitHub
parent 774c9ddc64
commit ccbb687ca0
5 changed files with 144 additions and 7 deletions

View File

@ -16,9 +16,8 @@ coder tokens create [flags]
| | |
| ----------- | ---------------------------------- |
| Type | <code>duration</code> |
| Type | <code>string</code> |
| Environment | <code>$CODER_TOKEN_LIFETIME</code> |
| Default | <code>720h0m0s</code> |
Specify a duration for the lifetime of the token.