⚠ Refactor in progess ⚠
EWW! Your code is ugly!
Yes, I know and I am very self consious about it! I’ll eventually get good at writing Rust… Maybe. In the meantime, checkout the todo list.
Random Ramble is a simple random words generator written in rust.
It aims to generate a couple of words randomly based on parameters, such as starting patterns, themes etc.
One of its (few) usecase is to generate a sprint name or a release name.
To build from source: first, clone this repository.
git clone https://github.com/CaptainSpof/random-ramble.git
Requires cargo 1.40 or newer
cargo build
cargo build --release
docker build -t random-ramble .
By default, random-ramble
will generate a couple of adjective and theme. It is
however possible to specify a manual template.
The template follow the tera
notation (which is inspired by Jinja2)
This allow multiple features:
- random entry from all themes / adjs
Available choices are:
adj
for adjectivestheme
for themes
{{ adj }} {{ theme }}
- random entry from a specific subset
Allow you to limit the categorie of either
adj
ortheme
{{ adjs.en.0 }} {{ themes.superhero.0 }}
- filter the output
You can apply a filter to the output:
{{ adj | title }} {{ themes.superhero.0 | upper }}
field in the dot notation need an index .i.e:
{{ themes.superhero.0 }} {{ themes.superhero.1 }}
Add one or multiple entries to a theme or create a new one if the theme is not found.
rr add superhero Batman
rr add superhero < /tmp/heroes.txt
rr add -a fr Inutile
Remove one or multiple entries from a theme.
remove
del
rr del superhero Batman
rr del superhero < /tmp/heroes.txt
rr del -a fr Inutile
random-ramble 0.3.0
Cédric Da Fonseca <dafonseca.cedric@gmail.com>
A simple random words generator
USAGE:
rr [FLAGS] [OPTIONS] [pattern] [SUBCOMMAND]
FLAGS:
-h, --help
Prints help information
-V, --version
Prints version information
-v, --verbose
-v: INFO|WARN|ERROR
-vv: INFO|WARN|ERROR|DEBUG
-vvv: INFO|WARN|ERROR|DEBUG|TRACE
OPTIONS:
-a, --adjectives <adjectives>...
A list of adjectives to be chosen from
--adjectives-path <adjectives-path>
Path to the adjectives files [env: RR_ADJS_PATH=~/Projects/Rust/random-ramble/dict/adjectives]
[default: ./dict/adjectives]
-n <number>
The length of the list to be returned [env: RR_NB_RESULT=] [default: 10]
-T, --template <template>
Provide a template from which to generate words
-t, --themes <themes>...
A list of themes to be chosen from
Themes preceded by '!' will be excluded
--themes-path <themes-path>
Path to the themes files [env: RR_THEMES_PATH=~/Projects/Rust/random-ramble/dict/themes] [default:
./dict/themes]
ARGS:
<pattern>
The pattern to start with
SUBCOMMANDS:
add Add entries to a theme, or create a new theme
delete Delete entries from a theme [aliases: remove, del]
help Prints this message or the help of the given subcommand(s)
This project is configured via environment variables or by setting the desired values via the CLI.
The number of results to be generated.
default value: 10
export RR_NB_RESULT=25
./rr -n 25 [...]
The path to the themes files.
default value: “./dict/themes”
export RR_THEMES_PATH="~/.local/random_ramble/themes"
./rr --themes-path="~/.local/random_ramble/themes" [...]
The path to the adjectives files.
default value: “./dict/adjectives”
export RR_ADJS_PATH="~/.local/random_ramble/adjectives"
./rr --adjectives-path="~/.local/random_ramble/adjectives" [...]
Generate random words with default parameters, for words starting with ‘A’:
./rr a
output:
Awful All-father Hercules
Abusive Abe Sapien
Abnormal Ariel
Awesome Airman
Athletic Aegis
Adorable All For One
Awkward Adam Destine
Abject Agent Mulder
Aboriginal Amunet Black
Able Aegeus
Generate 3 random words with default parameters, for words starting with ‘A’:
./rr a -n 3
output:
Absorbed Ajax
Abnormal Akron
Angelic Alexander Anderson
Generate 3 random words of theme ‘animals’ with default parameters, for words starting with ‘A’:
./rr a -n 3 --themes animal
output:
Arrogant Aardvark
Apprehensive Anteater
Alive Antelope
Generate 3 random words of any available theme besides ‘disney’ with default parameters:
./rr -n 3 --themes '!disney'
output:
Ambitious Dogfish
Stormy Fironic
Resourceful Magpie
Generate a template with random entries:
./rr -T '{{ themes.male_name.0 }}, the {{adjs.superlative.0 | lower }} {{ adj | lower }} {{ themes.color.0 | lower }} {{ themes.videogame.0 }}' -n 4
output:
Alexander, the faintest mission-critical pink Peach
Asher, the funniest condescending yellow Agent 47
Thomas, the bloodiest tough white Vault Boy
Mateo, the busiest gangsta tilleul Dovahkiin
fd . -t f dict/themes --exec ./rr -t '{/}'