Skip to content

Commit e48be46

Browse files
committed
Fix up bin/cowsay and add bin/cowthink and add cows
1 parent 64b0589 commit e48be46

File tree

6 files changed

+53
-19
lines changed

6 files changed

+53
-19
lines changed

Dockerfile

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM python:3.8-alpine
22

33
RUN apk add --update \
4-
fish perl figlet fortune jq tzdata curl \
4+
fish perl figlet fortune jq tzdata curl binutils \
55
&& rm -rf /var/cache/apk/*
66

77
# Recent versions of fish force --color=always
@@ -17,5 +17,14 @@ RUN curl -sSL https://github.com/tnalpgge/rank-amateur-cowsay/archive/cowsay-3.0
1717
&& cd /usr/src/rank-amateur-cowsay-cowsay-3.04 \
1818
&& ./install.sh
1919

20+
RUN mkdir /usr/src/cowsay-buster \
21+
&& cd /usr/src/cowsay-buster \
22+
&& curl -sSL http://http.us.debian.org/debian/pool/main/c/cowsay/cowsay_3.03+dfsg2-6_all.deb -o cowsay.deb \
23+
&& ar x cowsay.deb data.tar.xz \
24+
&& tar xfJ data.tar.xz --strip-components=5 -C /usr/local/share/cows/ -- ./usr/share/cowsay/cows/
25+
26+
27+
COPY cows/* /usr/local/share/cows/
28+
2029
WORKDIR /irsh
2130
CMD /irsh/init

bin/cowsay

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
#!/usr/bin/fish
22

3-
set cows apt bud-frogs bunny calvin cheese cock cower daemon default dragon \
4-
dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep \
5-
ghostbusters gnu hellokitty kangaroo kiss koala kosh luke-koala \
6-
mech-and-cow milk moofasa moose pony pony-smaller ren sheep skeleton \
7-
snowman stegosaurus stimpy suse three-eyes turkey turtle tux unipony \
8-
unipony-smaller vader vader-koala www
9-
103
set self (basename (status -f))
11-
argparse -n$self -xf,r n f= r W= e= T= b d g p s t w y -- $argv >/dev/null ^&1
4+
argparse -n$self -xf,r n f= r l W= e= T= b d g p s t w y -- $argv >/dev/null ^&1
125
or begin
13-
printf "%s: Invalid commandline" $self >&2
6+
printf "%s: Invalid commandline\n" $self >&2
147
exit 1
158
end
169

10+
set cows ($self -l | tail -n +2 | tr ' ' '\n')
11+
1712
if set -q _flag_r[1]
1813
set flag_f -f $cows[(math (random)%(count $cows)+1)]
1914
else if set -q _flag_f
@@ -37,6 +32,11 @@ set -q _flag_W; and set flag_W -W $_flag_W
3732
set -q _flag_e; and set flag_e -e $_flag_e
3833
set -q _flag_T; and set flag_T -T $_flag_T
3934

40-
cowsay $_flag_n[1] $flag_f $flag_W $flag_e $flag_T \
35+
if set -q _flag_l
36+
printf "%s" "$cows"
37+
exit 0
38+
end
39+
40+
$self $_flag_n[1] $flag_f $flag_W $flag_e $flag_T \
4141
$_flag_b[1] $_flag_d[1] $_flag_g[1] $_flag_p[1] \
4242
$_flag_s[1] $_flag_t[1] $_flag_w[1] $_flag_y[1] -- $argv

bin/cowthink

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cowsay

cows/geordinscupe.cow

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
$the_cow = <<"EOC";
2+
$thoughts
3+
$thoughts , , ,, ,,,,,,, ,, ,
4+
,,,,,,, ,,,, ,,,,,,,,,,,,,,, ,,,,,,,,,,,
5+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
6+
,,,,,,ooOOoOoooooooooooooooooOoOooo,,,,,,
7+
,, , oOOOOOOoOOOOOOOoo ,,
8+
,, ,,oOOoOoooooOooOOOOOooOoooooOoOOOo, ,,
9+
,,, ,,ooo, ,oo,,ooOo,oOoo,ooo, ,ooo,, ,,,
10+
,,,ooo oo,,, ,,,,,,,,,, , ,oo ooo,,,
11+
,,,oo,, , , , ,,,,,,,,,,, , ,oo,,,
12+
,,,o,,,,ooOo,, ,,,ooo,,,oooo,, ,ooOoo,,,,o ,,
13+
,,,o,,,ooo,,,ooooo,,,,, ,ooOoo,,,ooo,,,,,,,
14+
,,,,,oooooooOOOOo,,oO0Oo,,oOOOOooooooo,,,,,
15+
, ,,,ooooOOOO00OOo,O O,oOOO0OOOooooo,,, ,
16+
,O , ,,oooOO000000OOOoooOOOOOoooOO000000OOooo,, , O,
17+
, oo ,,oooO0000000OOooooOOoOOOoooOO000000OOooo,, ,o, ,
18+
,,,oooo ,,,oOO000000OOoOoooooooooooooOO000000OoO,,, oooo,,
19+
,,o,O,, ,oOO0000000OOO,,0O000O0O0,,oOO0000O00OOo, ,O,,,,
20+
,, ,,oOoOO000000O O000000OOoOo,, o,
21+
, ,,oOOO00O00O0 ,0000O0OOooo, ,,
22+
,,,,,oooO0O0000 ,000O00Oooo,,,,,
23+
,,,,,,,oooO0O000O O000O0O,oo,, ,, ,
24+
,,,,,,,,,oooOOOOOO, $tongue ,OO0OOOoooo,,,,,,,,
25+
,,oo,,,,oooo,oOO0oOo, ,,, ooOo0OOo,ooo, ,,,oo,,
26+
,,ooo, ,oooooooooOoOooOOoOOOoOOooO,Oooooooooo, ,ooo,,
27+
,ooo,, ,oooooo,oooo0OOOOOOOoOOOOooOOoOoo,oooooo, ,,oooo
28+
EOC

man/cowsay

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
[-n] [-f cow] [-r] [-W width] [-e eyes] [-T tongue] [-bdgpstwy] [string]
1+
[-n] [-f cow] [-r] [-l] [-W width] [-e eyes] [-T tongue] [-bdgpstwy] [string]
22

33
A speaking cow reads string or stdin.
44

55
-n disable forced wrapping (cannot be used when passing string)
6-
-f use a different cow. Cannot be used with -r. Valid cows are:
7-
apt bud-frogs bunny calvin cheese cock cower daemon default dragon
8-
dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep
9-
ghostbusters gnu hellokitty kangaroo kiss koala kosh luke-koala
10-
mech-and-cow milk moofasa moose pony pony-smaller ren sheep skeleton
11-
snowman stegosaurus stimpy suse three-eyes turkey turtle tux unipony
12-
unipony-smaller vader vader-koala www
6+
-f use a different cow. Cannot be used with -r.
137
-r use a random cow. Cannot be used with -f
8+
-l list all available cows
149
-W set text wrap width
1510
-e set eye string
1611
-T set tongue string

man/cowthink

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cowsay

0 commit comments

Comments
 (0)