Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brittonhayes/roll
A simple Go package and CLI for dice rolling 🎲
https://github.com/brittonhayes/roll
cli docker dungeons-and-dragons go rpg
Last synced: 16 days ago
JSON representation
A simple Go package and CLI for dice rolling 🎲
- Host: GitHub
- URL: https://github.com/brittonhayes/roll
- Owner: brittonhayes
- License: mit
- Created: 2022-05-12T01:15:54.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-18T23:02:03.000Z (11 months ago)
- Last Synced: 2024-10-04T17:39:03.069Z (about 1 month ago)
- Topics: cli, docker, dungeons-and-dragons, go, rpg
- Language: Go
- Homepage:
- Size: 643 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🎲 Roll
[![Go Reference](https://pkg.go.dev/badge/github.com/brittonhayes/roll.svg)](https://pkg.go.dev/github.com/brittonhayes/roll)
![Latest Release](https://img.shields.io/github/v/release/brittonhayes/roll?label=latest%20release)
[![Lint](https://github.com/brittonhayes/roll/actions/workflows/lint.yml/badge.svg)](https://github.com/brittonhayes/roll/actions/workflows/lint.yml)
[![Test](https://github.com/brittonhayes/roll/actions/workflows/test.yml/badge.svg)](https://github.com/brittonhayes/roll/actions/workflows/test.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/brittonhayes/roll)](https://goreportcard.com/report/github.com/brittonhayes/roll)A simple Go package and CLI for dice rolling.
## âš¡ Usage
How to use Roll as a CLI or a library
### CLI
Installation via Go or Docker
```bash
# Go
go install github.com/brittonhayes/roll/cmd/roll
``````bash
# Docker
docker run --rm -it ghcr.io/brittonhayes/roll:latest 1d6+2
```Using the command line tool
```bash
# Run the CLI
Usage: rollA simple CLI for dice rolling
Arguments:
Dice to roll +/- modifiers e.g. 'roll 1d6', 'roll 2d12+20', or 'roll 1d20-5'Flags:
-h, --help Show context-sensitive help.
-v, --verbose Display verbose log output ($VERBOSE)
-s, --skip-spinner Skip loading spinner ($SKIP_SPINNER)# Roll a D6
roll 1d6# Roll with modifiers
roll 1d6+2
```## 📺 Preview
![roll.gif](./roll.gif)
### Package
Using the package
```go
func main() {
// Create a new d6
d := roll.NewD6()// Roll the die
fmt.Println("Rolling", d)
result := d.Roll()// Print the result
fmt.Println(result)
}
```