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:

  1. Help text said "in hours" but validation required whole days
  2. Truncation to midnight used local timezone, causing inconsistent expiration dates depending on when/where the command was run
  3. Format like "720h" for 30 days was not intuitive

Changes:

  • Created custom TokenDuration type 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 30d instead of 720h0m0s
  • All validation errors provide clearer messages

Resolves #8055 (closed)

Related Issues

Resolves #[issue_number]

How has this been tested?

Screenshots (if appropriate):

Merge request reports

Loading