Crates.io | fortunelike |
lib.rs | fortunelike |
version | 0.2.0 |
source | src |
created_at | 2017-11-20 03:19:55.062293 |
updated_at | 2017-11-20 03:19:55.062293 |
description | Classic cli utility that prints random messages |
homepage | |
repository | https://github.com/octalsrc/fortunelike |
max_upload_size | |
id | 39976 |
size | 41,993 |
fortunelike
v0.2.0It's like the
classic fortune
program, but it's written in Rust (as a learning exercise). It also
uses a Yaml-format fortune database.
fortunelike
outputs a random entry from the fortune database. The
database path can be chosen with the -f
/ --dbfile
option or by
setting the FORTUNELIKE_DB
environment variable.
$ fortunelike -f example_db.yaml
You find yourself reading a confusing message.
If no database path is provided, fortunelike
first defaults to
$HOME/.config/fortunelike-db
and then /etc/fortunelike-db
. If no
database at all is found, or if the first one that is found does not
exist or cannot be parsed, a [?]
will be output.
fortunelike
usually ends its output with a newline; if you don't
want this, pass the -i
/ --inline
option. This is particularly
useful if you want to include the fortune in the middle of some other
text.
$ echo "Insert some $(fortunelike -i -f words_db.yaml) text."
Insert some banana text.
The fortune database file is a list of strings in Yaml format. See
example_db.yaml
and words_db.yaml
for examples.