3 releases

0.1.3 May 31, 2019
0.1.1 May 30, 2019
0.1.0 May 30, 2019

#5 in #roller

24 downloads per month

MIT license

14KB
340 lines

Dice Roller

A handy roll command for rolling dice on the command line.

Usage

roll [--verbose] [DEFINITION]
roll --version

Options

  • --verbose: include the individual dice rolls in the output; by default displays only the total.
  • --version: display the version information.

Definition

Uses standard dice notation to define which dice and modifiers to use.

  • roll: an easy-peasy six-sided dice roll.
  • roll d20: specify to roll a 20-sided die.
  • roll 2d8: roll two 20-sided dice.
  • roll 2d10+4: roll 2 10-sided dice and add 4 to the result.
  • roll 3d4-2: roll 3 4-sided dice and subtract 2 from the result.

Installation

Via Cargo

If you already have the Rust toolchain installed:

cargo install dice-roller

Via Homebrew

# add this repo as a tap
brew tap pbyrne/roller https://github.com/pbyrne/roller
# then you can install like any other package
brew install dice-roller

Download the binaries

OS-specific binaries are attached to each release automatically. Download the one that's right for you and place it somewhere you can call it.

TODOs

  • 2d5+4d20
  • Graceful error handling on invalid input

Dependencies

~3.5–4.5MB
~70K SLoC