gravl

package module
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Overview

build codecov

gravl logo

gravl command line clients for activity-related services

Activity clients

Installation

Docker

gravl is available as a Docker image on GitHub Container Registry:

# Minimal image (just the binary)
FROM ghcr.io/bzimmer/gravl:latest AS gravl
FROM scratch
COPY --from=gravl /usr/bin/gravl /usr/bin/gravl
ENTRYPOINT ["/usr/bin/gravl"]

# Or with a base distro if you need shell access
FROM ghcr.io/bzimmer/gravl:latest AS gravl
FROM debian:bookworm-slim
COPY --from=gravl /usr/bin/gravl /usr/bin/gravl

Available image tags:

  • ghcr.io/bzimmer/gravl:latest - latest stable release
  • ghcr.io/bzimmer/gravl:v1.2.3 - specific version

Homebrew

brew install bzimmer/tap/gravl

Authentication

Strava requires OAuth2 tokens to access the API on behalf of a user. gravl includes an oauth subcommand for Strava to start a local web server and guide you through the authorization flow.

Strava

  1. Register an application at https://www.strava.com/settings/api to obtain a client ID and client secret. Set the "Authorization Callback Domain" to localhost.
  2. Export the client credentials as environment variables:
    export STRAVA_CLIENT_ID=<your client id>
    export STRAVA_CLIENT_SECRET=<your client secret>
    
  3. Run the OAuth command to start the local authorization server:
    gravl strava oauth
    
  4. Open a browser to http://localhost:9001. You will be redirected to Strava to authorize the application.
  5. After authorizing, the browser will display a JSON document containing the access and refresh tokens.
  6. Copy the refresh token and set it as an environment variable:
    export STRAVA_REFRESH_TOKEN=<your refresh token>
    

Documentation

Documentation

Index

Constants

View Source
const RuntimeKey = "github.com/bzimmer/gravl#RuntimeKey"

Variables

This section is empty.

Functions

func Afters

func Afters(afs ...cli.AfterFunc) cli.AfterFunc

Afters combines multiple `cli.AfterFunc`s into a single `cli.AfterFunc`

func Befores

func Befores(bfs ...cli.BeforeFunc) cli.BeforeFunc

Befores combines multiple `cli.BeforeFunc`s into a single `cli.BeforeFunc`

func Stats

func Stats(c *cli.Context) error

Stats logs and encodes (if requested) the stats

func Token

func Token(n int) (string, error)

Token produces a random token of length `n`

Types

type Encoder

type Encoder interface {
	Encode(v any) error
}

type ExporterFunc

type ExporterFunc func(c *cli.Context) (activity.Exporter, error)

type Rt

type Rt struct {
	// Metadata
	Start time.Time

	// Activity clients
	Zwift            *zwift.Client
	Strava           *strava.Client
	RideWithGPS      *rwgps.Client
	CyclingAnalytics *cyclinganalytics.Client
	Hammerhead       *hammerhead.Client

	// Endpoints
	Endpoints map[string]oauth2.Endpoint

	// Export / Upload
	Exporters map[string]ExporterFunc
	Uploaders map[string]UploaderFunc

	// IO
	Fs      afero.Fs
	Encoder Encoder

	// Metrics
	Metrics *metrics.Metrics
	Sink    *metrics.InmemSink

	// Evaluation
	Filterer  func(string) (eval.Filterer, error)
	Evaluator func(string) (eval.Evaluator, error)
}

Rt holds the gravl runtime

func Runtime

func Runtime(c *cli.Context) *Rt

type UploaderFunc

type UploaderFunc func(c *cli.Context) (activity.Uploader, error)

Directories

Path Synopsis
qp
cmd
gravl command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址