I spent some time doing my first non-humor program in Rust,
rpick. It's still a simple program, but I find it useful
because I have a very hard time making simple decisions such as which restaurant to go to, or which
album to listen to next.
rpick uses a Gaussian probability model to pick from an ordered list
of candidates, ordered from least recently chosen to most recently chosen. It has a higher chance of
picking the less recently chosen items, while still allowing some fun room for the roll of the dice
to surprise you. It's
coming soon to a Fedora release near you.
rpick keeps its lists in a YAML file in your home config directory called
rpick.yml. For now, users must create this file by hand, and
rpick will manage it from
there. To get started with our restaurant example, create
~/.config/rpick.yml like this:
restaurant: model: gaussian choices: - Spirits - Lucky 32 - Centro - Sitti - Cookout ```
Then you can ask
rpick to pick one for you:
$ rpick restaurant
Choice is Lucky 32. Accept? (Y/n)
If you say yes, it will rewrite the yaml file like this:
restaurant: model: gaussian choices: - Spirits - Centro - Sitti - Cookout - Lucky 32 ```
Note that we passed
restaurant as an argument to
rpick - this told
rpick to look
restaurant object in
rpick.yml to find out which model to use and which choices
were available. This parameter is required, but its possible values are defined by you in your
model field in the config file is required, but at the time of writing only
is a valid model. There are tentative plans to add other models later in the future.
This project is available on crates.io.