Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eneko/random
A random command line tool to do random stuff 🎲
https://github.com/eneko/random
cli command-line-tool random randomize stdin swift swiftpm terminal
Last synced: 17 days ago
JSON representation
A random command line tool to do random stuff 🎲
- Host: GitHub
- URL: https://github.com/eneko/random
- Owner: eneko
- License: mit
- Created: 2018-09-15T05:24:45.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-01-17T17:18:27.000Z (almost 4 years ago)
- Last Synced: 2024-10-29T12:09:52.999Z (2 months ago)
- Topics: cli, command-line-tool, random, randomize, stdin, swift, swiftpm, terminal
- Language: Swift
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Random
A random command line tool to do random stuff![](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSttlmqumySvHGWVY7vOz3Axx3FBYyNDqDIkLpRmNJJx20ZpZuF)
## Usage
### Pick Command
Pick one from multiple options passed in as parameters or via standard input (`stdin`).From parameters:
```
$ random pick 🍊 🍎 🍍 🍇
🍍
```From `stdin`:
```
$ echo 🍊 🍎 🍍 🍇 | random pick
🍎
```Combined parameters and `stdin`:
```
$ echo 🍊 🍎 | random pick 🍍 🍇
🍇
```When `stdin` contains multiple lines, a random line is selected:
```
$ ls | random pick
Package.swift
$ ls -la | random pick
-rw-r--r-- 1 enekoalonso staff 1069 Sep 14 22:27 LICENSE
```If a single word is passed in, a random character is selected:
```
$ random pick eneko
e
```### Shuffle Command
Shuffle options passed in as parameters or via standard input in random order (`stdin`).```
$ random shuffle 🍊 🍎 🍍 🍇
🍍
🍎
🍊
🍇
```### Dice Command
Throw one or multiple dice.```
$ random dice
2
```Multiple throws:
```
$ random dice -n 6
1
6
6
1
6
3
```## Installation
Note: Requires Swift 4.2, works on Mac and Linux### With Homebrew
```
$ brew install eneko/tap/random
```### From Source
```
$ git clone https://github.com/eneko/Random.git
$ cd Random
$ make
```### Download Binary
```
$ curl -Ls https://github.com/eneko/Random/releases/download/latest/random.macos.zip -o /tmp/random.macos.zip
$ unzip -j -d /usr/local/bin /tmp/random.macos.zip
```