Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sckott/cowsay

cowsay w/ more animals, in R
https://github.com/sckott/cowsay

ascii-art r r-stats rstats

Last synced: 2 days ago
JSON representation

cowsay w/ more animals, in R

Awesome Lists containing this project

README

        

cowsay
======

```{r echo=FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE
)
```

![cran checks](https://badges.cranchecks.info/worst/cowsay.svg)
[![R-check](https://github.com/sckott/cowsay/workflows/R-check/badge.svg)](https://github.com/sckott/cowsay/actions?query=workflow%3AR-check)
[![codecov](https://codecov.io/gh/sckott/cowsay/graph/badge.svg?token=fewxwGHXfv)](https://app.codecov.io/gh/sckott/cowsay)
[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/cowsay)](https://github.com/r-hub/cranlogs.app)
[![cran version](https://www.r-pkg.org/badges/version/cowsay)](https://cran.r-project.org/package=cowsay)

### What is this?

If you are familiar with `cowsay` on the cli, then you know what this is, but for R. If not, read below. Why? Why not?

### History

cowsay was originally written by Tony Monroe, with the first code released in 1999. The version of cowsay you get via homebrew is a fork by Andrew Janke at ([code repo](https://github.com/cowsay-org/cowsay)). The code for the original can be found at [tnalpgge/rank-amateur-cowsay](https://github.com/tnalpgge/rank-amateur-cowsay) and the original website can be seen [on the Wayback Machine](https://web.archive.org/web/20120225123719/http://www.nog.net/~tony/warez/cowsay.shtml). Both the original and version by Janke are both written in Perl. The cowsay you get with `apt` on Linux machines is the last version Monroe released in 2016 (v3.0.4 or possibly v3.0.3).

This R package has some additional features the orginal cowsay doesn't have, but also lacks some features the original has. This package doesn't yet support custom eyes and tongue for the cow or any other animals.

### Contributors (alphabetical)

```{r echo=FALSE}
peeps <- c(
"Scott Chamberlain",
"Tyler Rinker",
"Thomas Leeper",
"Noam Ross",
"Rich FitzJohn",
"Kiyoko Gotanda",
"Carson Sievert",
"Andy Teucher",
"Karl Broman",
"Franz-Sebastian Krah",
"Lucy D'Agostino McGowan",
"Guangchuang Yu",
"Paolo Sonego",
"Philipp Boersch-Supan",
"Andreas Brandmaier",
"Amanda Dobbyn",
"Marion Louveaux",
"David Schoch"
)
```

```{r results='asis', echo=FALSE}
cat(c("", sort(peeps)), sep = "\n * ")
```

That's right, it takes `r length(peeps)` people to make `cowsay` - it's that hard.

### Contributing

See [CONTRIBUTING.md][contrib]

### Where to find ASCII animal art

Sources to look in:

* https://asciiart.website/ - again, this person only collects them - no mention of license, permissions, etc.

Permissions

In the ascii art mailing list https://groups.google.com/forum/#!forum/alt.ascii-art they say:

```
As for posting other people's ASCII art,
after a discussion in news:alt.ascii-art _ ___
the following rules were agreed upon: #_~`--'__ `===-,
1. If an ASCII ART picture has initials `.`. `#.,//
on it, leave them on when posting it ,_\_\ ## #\
2. If an ASCII ART picture doesn't have `__.__ `####\
initials on it, mention that you ~~\ ,###'~
didn't draw it when posting it. \##'
3. If somebody posts a picture without [nosig]
initials and you have an original copy
with initials on, feel free to re-post the original version.
* The re-post ought not to be taken personally, as we all
know that ASCII art often loses proper credits.
Responses to the re-post are not necessary.

One contributor, name of Krogg, suggested the following:

1.) Ultra polite:...ya make yer own ascii and use it.
2.) Very polite:...Ya contact the author and ask if ya
can use it...
3.) polite:...Ya use it but you keep the Credits
in there like they should be.
4.) rude:...Ya use it and strip credits.
5.) Very rude:...Ya use it and claim that it Is
_Your_ very own creation...
```

So, let's go with this rule: Let's include found (on the web) ascii art in this pkg, include signature if there, and if no signature, put in a `[nosig]` (see above).

### Quick watch start

Asciicast:

### Install

From CRAN

```{r eval=FALSE}
install.packages("cowsay")
```

Dev version

```{r eval=FALSE}
# install.packages("pak")
pak::pak("sckott/cowsay")
```

```{r}
library("cowsay")
```

### The animals

```{r}
sort(names(animals))
```

### Say Something

```{r}
say("time")
```

```{r}
say("ain't that some shit", "chicken")
```

Add some color:

```{r}
library(crayon)
```

```{r eval=FALSE}
say("boo!", "ghost",
what_color = "cyan", by_color = "saddlebrown"
)
```


ghost

```{r eval=FALSE}
say("I love hooo you are!", "owl",
what_color = rgb(0, 1, 1), by_color = "#FF0000"
)
```


owl

String styles together [crayon-style](https://github.com/r-lib/crayon#styles):

```{r eval=FALSE}
say(
what = "rms", by = "rms",
what_color = yellow$bgMagenta$bold,
by_color = cyan$italic
)
```


rms

This doesn't preclude you from adding extra crayon colors to your `what` string directly - but the results are not super pretty:

```{r eval=FALSE}
say(
what = paste0("hello ", crayon::yellow("there "), crayon::underline("world")),
by = "trilobite"
)
```


trilobite

### Vary type of output, default calls message()

```{r}
say("hell no!")
```

```{r}
say("hell no!", type = "warning")
```

```{r}
say("hell no!", type = "string")
```

### Catfacts!!!!

From the catfacts API at

```{r}
say("catfact", "cat")
```

### Long cat

From the a Boing Boing tweet on 2014-05-10 "twitter.com/BoingBoing/status/465170473194512384" (post may be gone)

```{r}
say("it's caturday", "longcat")
```

### Grumpy cat

```{r}
say("NO!", by = "grumpycat")
```

```{r}
say("WOKE UP TODAY, IT WAS TERRIBLE", by = "grumpycat")
```

```{r}
say("I HAD FUN ONCE, IT WAS AWFUL", by = "grumpycat")
```

### Bunny Holding a sign

```{r}
say(by = "signbunny")
```

### Fish

```{r}
say(by = "fish")
```

### R fortunes

```{r}
library(fortunes)
say("fortune", "cat")
```

You can also pick a particular fortune by number or regex search - if the `fortune` parameter is not `NULL` you don't have pass anything to the `what` parameter (the 1st parameter)

```{r}
say(fortune = 100)
```

```{r}
say(fortune = "whatever")
```

### Trilobite

```{r}
say("Hi there :)", by = "trilobite")
```

### Shark

```{r}
say("Q: What do you call a solitary shark\nA: A lone shark", by = "shark")
```

### Buffalo

```{r}
say("Q: What do you call a single buffalo?\nA: A buffalonely", by = "buffalo")
```

### Clippy

```{r}
say(fortune = 59, by = "clippy")
```

### Yoda

```{r eval=FALSE}
say("fortune", by = "yoda")
```

### Bats!

```{r}
say("hi, i'm a bat", by = "bat")
```

See also `bat2`

### Monkey!

```{r}
say("fortune", by = "monkey")
```

### Daemon!

```{r}
say("fortune", by = "daemon")
```

### Egret

```{r}
say("je ne regrette rien", by = "egret")
```

See also `bat2`

### Endless horse

```{r eval=FALSE}
endless_horse()
## -----
## Hello world!
## ------
## \
## \
## \
## ,
## _,,)\.~,,._
## (()` ``)\))),,_
## | \ ''((\)))),,_ ____
## |6` | ''((\())) "-.____.-" `-.-,
## | .'\ ''))))' \)))
## | | `. '' ((((
## \, _) \/ |))))
## `' | (((((
## \ | ))))))
## `| | ,\ /((((((
## | / `-.______.< \ | )))))
## | | / `. \ \ ((((
## | / \ | `.\ | (((
## \ | | | )| | ))
## | | | | || | ' [endless.horse]
## | | | | || |
##
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
## | | | | || |
```

### Using pipes

```{r}
library("magrittr")
"I HAD FUN ONCE, IT WAS AWFUL" %>% say("grumpycat")
```

### I just want the animals!

Okay, hold your endless horses. Just use the exported vector `animals`, and you can select the animal you want by name.

```{r}
animals["clippy"]
```

## Meta

* License: MIT
* Please note that this project is released with a [Contributor Code of Conduct][coc]. By participating in this project you agree to abide by its terms.

[coc]: https://github.com/sckott/cowsay/blob/main/.github/CODE_OF_CONDUCT.md
[contrib]: https://github.com/sckott/cowsay/blob/main/.github/CONTRIBUTING.md