cowsay

Version, currently 0.0.42 versions

github.com/kojix2/cowsay.cr

A Crystal implementation of the classic cowsay program.

3 stars
0 dependents
License: not declared

Nothing has been indexed for 0.0.4 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  cowsay:
    github: kojix2/cowsay.cr
    version: ~> 0.0.4

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.0.4. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

Cowsay (In Crystal)

build

 ___________
< OMGHI2U!! >
 -----------
      \   ^__^
       \  (oo)\_______
          (__)\       )\/\
              ||----w |
              ||     ||

A Crystal implementation of the classic cowsay program, which generates ASCII art of a cow with a message.

Installation

From Binary

Download the latest binary from the Releases page.

From Source

git clone https://github.com/kojix2/cowsay.cr
cd cowsay.cr
shards build --release

The compiled binary will be available at bin/cowsay.

Usage

As a Command Line Tool

Basic usage:

bin/cowsay "Hello, World!"

Output:

 _____________
< Hello, World! >
 -------------
      \   ^__^
       \  (oo)\_______
          (__)\       )\/\
              ||----w |
              ||     ||

Using a different character:

bin/cowsay -c tux "Hello, Linux!"

Making the character think:

bin/cowsay -n "I am thinking..."

Using different modes:

bin/cowsay -b "Borg mode"  # Borg mode
bin/cowsay -d "Dead mode"  # Dead mode
bin/cowsay -s "Stoned mode"  # Stoned mode

Custom eyes and tongue:

bin/cowsay -e ^^ -T ~~ "Custom face"

Colored output:

bin/cowsay -C "Colorful message!"

As a Library

require "cowsay"

# Basic usage
puts Cowsay.say("Hello, World!")

# Using a different character
puts Cowsay.say("Hello, Linux!", character: "tux")

# Making the character think
puts Cowsay.think("I am thinking...")

# Using different modes
puts Cowsay.say("Borg mode", mode: "borg")
puts Cowsay.say("Dead mode", mode: "dead")

# Custom eyes and tongue
puts Cowsay.say("Custom face", eyes: "^^", tongue: "~~")

# Colored output
puts Cowsay.say("Colorful message!", color: true)

# Direct class usage
cow = Cowsay::Cow.new(mode: "stoned", color: true)
puts cow.say("I'm feeling strange...")

Command Line Options

Usage: cowsay [options] message
    -c, --cow CHARACTER              Selects a character
    -n, --think                      Makes the cow think
    -e EYES, --eyes=EYES             Sets the eyes of the cow (default 'oo')
    -T TONGUE, --tongue=TONGUE       Sets the tongue of the cow (default '  ')
    -b, --borg                       Borg mode
    -d, --dead                       appear dead
    -g, --greedy                     Greedy mode
    -p, --paranoid                   Paranoid mode
    -s, --stoned                     Stoned mode
    -t, --tired                      Tired mode
    -w, --wired                      Wired mode
    -y, --young                      Youthful appearance
    -l, --list                       Lists available characters
    -W, --wrap-column WIDTH          Sets the width of the cow
    -C, --color                      Enable colored output
    -v, --version                    Displays version information
    -h, --help                       Displays this help message

Available Characters

You can list all available characters with:

bin/cowsay -l

Some notable characters include:

  • cow: The default cow
  • tux: The Linux mascot
  • dragon: A dragon
  • sheep: A sheep
  • turtle: A turtle
  • bunny: A bunny
  • moose: A moose
  • And many more!

Face Modes

The following face modes are available:

ModeDescriptionEyesTongue
defaultDefault faceoo
borgBorg mode==
deadDead face==U
greedyGreedy face$$
paranoidParanoid face@@
stonedStoned face**U
tiredTired face--
wiredWired faceOO
youngYoung face..

Development / Contributing

This project was forked from ruby cowsay.

Here are some ways you can contribute:

  • Fork this repository
  • Report bugs
  • Fix bugs and submit pull requests
  • Write, clarify, or fix documentation
  • Suggest or add new features
  • Add tests

Special Thanks

Special thanks to Tony Monroe for the original perl CLI implementation. You can find out more about that here:

http://www.nog.net/~tony/warez/cowsay.shtml