Skip to content

feat: respect user display preferences for units (metric/statute/statute UK) #24

Description

@bpauli

Summary

All distance formatting in gccli is hardcoded to metric (km). The CLI should respect the user's Garmin Connect display preferences (metric, statute, statute UK) when formatting distances, paces, and weights.

Current behavior

formatDistance() in internal/cmd/activities.go always converts meters to km. This affects all commands that display distances: activities list, activities search, calendar, etc.

Desired behavior

  • Fetch user settings from GET /userprofile-service/userprofile/user-settings/ (has a displayFormat field)
  • Format distances as km or miles based on the preference
  • Format paces as min/km or min/mi
  • Format weights as kg or lbs where applicable
  • Support metric, statute, and statute_uk display formats
  • Cache the preference per session to avoid repeated API calls

Scope

  • formatDistance() — meters → km or mi
  • formatDuration() / pace formatting — where applicable
  • Calendar event details (completion target, goal pace)
  • Activity listing, search, details
  • Body composition / weight display
  • Any other commands that format physical units

Notes

Discovered while implementing the calendar command — the event detail API returns completionTarget with explicit units (meter or kilometer), but the CLI always renders in km regardless of user preference.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions