______________________________
< Available on Maven Central! >
------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Detailed information can be found in the CHANGELOG
The Jar available on Maven Central is The One Jar and can be used in any of the advertised ways:
The first two scenarios require you to manually download The One Jar from Maven. It will be named following the convention cowsay-{version}.jar
.
E.g. for version 1.1.0
you would go here and download cowsay-1.1.0.jar.
All the ways of using it support configuration consistent with the command line flags of the original application, including full support for COWPATH
environment variable.
Documentation can be found in various man pages on the web.
It also introduces cowjars which is a way of adding extra cows to the Java classpath.
- Download the executable jar as described above.
- Download the wrapper scripts.
- Update your PATH
Once installed you can execute cowsay and cowthink from the command line like so:
# Simple cowsay CLI
cowsay -f stegosaurus Moo!
# Pipe to cowsay
echo "Piping to cowsay" | cowsay -f dragon
__________________
< Piping to cowsay >
------------------
\ / \ //\
\ |\___/| / \// \\
/0 0 \__ / // | \ \
/ / \/_/ // | \ \
@_^_@'/ \/_ // | \ \
//_^_/ \/_ // | \ \
( //) | \/// | \ \
( / /) _|_ / ) // | \ _\
( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-.
(( / / )) ,-{ _ `-.|.-~-. .~ `.
(( // / )) '/\ / ~-. _ .-~ .-~^-. \
(( /// )) `. { } / \ \
(( / )) .----~-.\ \-' .~ \ `. \^-.
///.----..> \ _ -~ `. ^-` ^-_
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
/.-~
Download the executable jar as described above and run it like so:
# Same args as cowsay CLI
java -jar cowsay.jar -f tux "Moo!"
# Can invoke cowthink like so
java -jar cowsay.jar --cowthink "Moo!"
# Can pipe to it
echo Moo! | java -jar cowsay.jar
Include it as a dependency in your project, for example in your Maven pom.xml:
<dependency>
<groupId>com.github.ricksbrown</groupId>
<artifactId>cowsay</artifactId>
<version>1.1.0</version>
<!-- The "lib" classifier is optional, but it gives you a MUCH smaller jar which is all you need as a Java library -->
<classifier>lib</classifier>
</dependency>
Then use the main methods Cowsay.say and Cowsay.think.
String[] args = new String[]{"-f", "Stegosaurus", "Hello from Java!"};
String result = Cowsay.say(args);
System.out.println(result);
__________________
< Hello from Java! >
------------------
\ . .
\ / `. .' "
\ .---. < > < > .---.
\ | \ \ - ~ ~ - / / |
_____ ..-~ ~-..-~
| | \~~~\.' `./~~~/
--------- \__/ \__/
.' O \ / / \ "
(_____, `._.' | } \/~~~/
`----. / } | / \__/
`-. | / | / `. ,~~|
~-.__| /_ - ~ ^| /- _ `..-'
| / | / ~-. `-. _ _ _
|_____| |_____| ~ - . _ _ _ _ _>
Or with CowExecutor like so:
CowExecutor cowExecutor = new CowExecutor();
cowExecutor.setCowfile("Stegosaurus");
cowExecutor.setMessage("Hello from Java!");
String result = cowExecutor.execute();
System.out.println(result);
To add additional cows with cowjars:
<dependency>
<groupId>com.github.ricksbrown</groupId>
<artifactId>cowjar-extra</artifactId>
<version>1.1.0</version>
</dependency>
For a working java example see cowsay-example
<plugin>
<groupId>com.github.ricksbrown</groupId>
<artifactId>cowsay</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>say-moo</id>
<phase>compile</phase>
<goals>
<goal>moo</goal>
</goals>
<configuration>
<message>Compiling with Maven...</message>
<cowfile>daemon</cowfile>
<!-- Other options:
<eyes>Oo</eyes>
<mode>b</mode>
<think>true</think>
<tongue> V</tongue>
<wrap>60</wrap>
-->
</configuration>
</execution>
</executions>
</plugin>
_________________________
< Compiling with Maven... >
-------------------------
\ , ,
\ /( )`
\ \ \___ / |
/- _ `-/ '
(/\/ \ \ /\
/ / | ` \
O O ) / |
`-^--'`< '
(_.) _ ) /
`.___/` /
`-----' /
<----. __ / __ \
<----|====O)))==) \) /====
<----' `--' `.__,' \
| |
\ /
______( (_ / \______
,' ,-----' | \
`--{__________) \/
Try running maven on the example java project: cowsay-example
<taskdef name="cowsay"
classname="com.github.ricksbrown.cowsay.ant.CowsayTask"
classpath="cowsay.jar"/>
<!--
<cowsay message="Moo!"/>
<cowsay message="Moo!" think="true"/>
<cowsay message="Moo!" mode="b"/>
<cowsay message="Moo!" eyes="Oo" tongue=" U"/>
-->
<cowsay message="The cool kids don't love Ant anymore" cowfile="tux"/>
______________________________________
< The cool kids don't love Ant anymore >
--------------------------------------
\
\
.--.
|o_o |
|:_/ |
// \ \
(| | )
/'\_ _/`\
\___)=(___/
Try running Ant on the example java project: cowsay-example
As with original cowsay you can add cowfiles using the environment variable COWPATH
and using the -f
command line flag.
To facilitate adding cowfiles when used as a Maven plugin, Ant task or Java library you can use the provided cowjars (or create your own).
The cowsay-example project demonstrates how to use cowjars.
--html
HTML output mode, produces accessible HTML5--alt <arg>
Choose your own alt text for HTML output mode--lang <arg>
Switch language
In the interests of absurd over-engineering this version of cowsay fully supports i18n.
New and/or improved translations welcome - the default (English) messages can be found in the file src/main/resources/MessagesBundle.properties
git clone https://github.com/ricksbrown/cowsay.git
cd cowsay
mvn install
Watch this informative video: