-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMoo.java
42 lines (35 loc) · 1.04 KB
/
Moo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import com.github.ricksbrown.cowsay.Cowsay;
import com.github.ricksbrown.cowsay.plugin.CowExecutor;
/**
* Some examples on how to use cowsay from Java.
* @author Rick Brown
*/
public final class Moo {
/**
* Private constructor.
*/
private Moo() {
}
/**
* Demonstrates a simple way to use cowsay from Java.
* @param args Some useless args.
*/
public static void main(final String[] args) {
String[] cowargs = new String[]{"-f", "sheep", "Cowsay from Java using com.github.ricksbrown.cowsay.Cowsay"};
String result = Cowsay.say(cowargs);
System.out.println(result);
Cowsay.main(new String[]{"-list"});
execute();
}
/**
* Demonstrates using the cowsay plugin executor.
*/
public static void execute() {
CowExecutor cowExecutor = new CowExecutor();
cowExecutor.setCowfile("elephant");
cowExecutor.setWrap("80");
cowExecutor.setMessage("This is another way to execute cowsay from Java using com.github.ricksbrown.cowsay.plugin.CowExecutor");
String result = cowExecutor.execute();
System.out.println(result);
}
}