fix: improve token duration flag clarity and consistency
Description
- fix: improve token duration flag clarity and consistency
The --duration flag for glab token create and glab token rotate
had ambiguous behavior that was misleading to users:
- Help text said "in hours" but validation required whole days
- Truncation to midnight used local timezone, causing inconsistent expiration dates depending on when/where the command was run
- Format like "720h" for 30 days was not intuitive
Changes:
- Created custom
TokenDurationtype supporting intuitive formats:-
30d(days) - new, more intuitive -
2w(weeks) - new, convenient shorthand -
720h(hours) - backward compatible
-
- Changed expiration calculation to use UTC midnight for consistency across all timezones
- Updated help text and examples to reflect new formats
- Default now displays as
30dinstead of720h0m0s - All validation errors provide clearer messages
Resolves #8055 (closed)
Related Issues
Resolves #[issue_number]