Skip to content

Latest commit

 

History

History
232 lines (154 loc) · 5.71 KB

README.md

File metadata and controls

232 lines (154 loc) · 5.71 KB

Pacer

GitHub release (latest SemVer) ci MIT

linux osx windows


Table of Contents

Introduction

Pacer is a CLI application that provides commands useful for runners. Pacer offers roughly two different services:

  1. Taking running data and generating graphical charts e.g. plotting runs by distance.

  2. Performing convenient calculations (e.g. deriving pace from a distance and duration).

Commands

Chart

The chart command generates a build directory that contains an html file with charts.

build/
├── bundle.js
└── index.html

1 directory, 2 files

Charts are generated from two inputs:

  • A runs file (toml or garmin csv), containing a list of all runs the user may want to chart.
  • A chart-requests.toml file, that determines how to construct the chart(s). The html page will contain a chart for each request in the file.

Important

The chart command requires npm (nodejs) to be installed: https://nodejs.org/en/download

Examples

Building the example here i.e.

$ pacer chart --data examples/

will generate an html page with several charts like this one:

example_chart

See the examples/ directory and the faq.md for more information.

Convert

The convert command converts quantities to different units.

Examples

$ pacer convert --distance 5km --unit mi
3.11 mi

$ pacer convert --pace '5m20s /mi' --unit km
3'19" /km

Warning

With convert, pace must include units i.e. either /km or /mi. Furthermore, pace cannot be given in meters nor converted to meters; only kilometers and miles are allowed.

Derive

The derive command derives a third quantity from two others.

Examples

# derives the pace from distance and duration
$ pacer derive --distance marathon --duration 3h15m
4'37" /km

# reverse of the above (slight difference due to rounding)
$ pacer derive --distance marathon --pace 4m37s
3h 14'48"

# we can also convert the final result to a different unit
$ pacer derive --distance marathon --duration 3h15m -u mi
7'26" /mi

$ pacer derive --pace '5m45s /mi' --duration 20m
3.48 mi

Note

Built-in values like marathon assume unit kilometers, if nothing else is given.

Scale

The scale command is used for scaling a single quantity.

Examples

$ pacer scale --distance marathon -k 0.5
21.10 km

# we can convert the final result
$ pacer scale --distance marathon -k 0.5 -u miles
13.11 mi

$ pacer scale --pace '4m15s /km' -k 1.1
4'40" /km

# pace units are optional
$ pacer scale --pace 4m15s -k 1.1
4'40"

Warning

With scale, pace must include units if the final result is converted.

$ pacer scale --pace '4m15s' -k 1.1 -u mi
Scaling pace with --unit requires that the original units are given e.g. --pace '4m15s /km'.

Building

If you have never built a haskell program before, Cabal is probably the best choice.

Cabal

Prerequisites

The easiest way to install these is generally ghcup.

The current "blessed" version is ghc-9.10.1.

Build Pacer

Once you have cabal and ghc, pacer can be built locally with cabal build or installed globally (e.g. ~/.local/bin/pacer) with cabal install.

For further reproducibility, optional freeze files can be used e.g.

cabal build --project-file cabal.ghc9101.project

Note

Freeze files are provided for only select compilers.

Stack

Prerequisites

Like cabal and ghc, stack can be installed with ghcup.

Build Pacer

Once you have stack, pacer can be built with stack build or installed globally (i.e. ~/.local/bin/pacer) with stack install.

Nix

Prerequisites

Tip

The nix build comes packaged with node, so there is no need to install it separately to use the chart command.

Manually

Building with nix uses flakes. pacer can be built with nix build, which will compile and run the tests.

Nix expression

Because pacer is a flake, it can be built as part of a nix expression. For instance, if you want to add pacer to NixOS, your flake.nix should have:

# flake.nix
{
  inputs.pacer.url = "github:tbidne/pacer/main";
}

Then include this in the systemPackages:

# wherever your global packages are defined
{
  environment.systemPackages = [
    pacer.packages."${system}".default
  ];
}

FAQ

See faq.md.