mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 12:27:59 +01:00
support for multiple -f
This commit is contained in:
parent
14f56dc33e
commit
d5932f72bd
2 changed files with 12 additions and 5 deletions
|
@ -52,7 +52,8 @@ Show version of program.
|
||||||
List pony files.
|
List pony files.
|
||||||
.TP
|
.TP
|
||||||
.B \-f \fIname\fP
|
.B \-f \fIname\fP
|
||||||
Select a pony (either a file name or a pony name.)
|
Select a pony (either a file name or a pony name.), you can use this options multiple times,
|
||||||
|
and one of the will be selected randomly.
|
||||||
.TP
|
.TP
|
||||||
.B \-W \fIcolumn\fP
|
.B \-W \fIcolumn\fP
|
||||||
The screen column where the message should be wrapped
|
The screen column where the message should be wrapped
|
||||||
|
@ -87,9 +88,9 @@ ponysay was written by Erkin Batu Altunbaş <erkinbatu@gmail.com>
|
||||||
with major contributions from Mattias Andrée, Sven-Hendrik Haase, Jan Alexander Steffens et al.
|
with major contributions from Mattias Andrée, Sven-Hendrik Haase, Jan Alexander Steffens et al.
|
||||||
.\" See file CREDITS for full list.
|
.\" See file CREDITS for full list.
|
||||||
.PP
|
.PP
|
||||||
This manual page was written by Louis Taylor <kragniz@gmail.com>
|
This manual page was originally written by Louis Taylor <kragniz@gmail.com>
|
||||||
for the Debian project (and may be used by others), and edited
|
for the Debian project (and may be used by others), and edited by
|
||||||
by Mattias Andrée <maandree@kth.se>.
|
Mattias Andrée <maandree@kth.se> for the official ponysay release.
|
||||||
.br
|
.br
|
||||||
.PP
|
.PP
|
||||||
This program is licensed under WTFPL.
|
This program is licensed under WTFPL.
|
||||||
|
|
8
ponysay
8
ponysay
|
@ -115,12 +115,14 @@ say() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ponies=()
|
||||||
|
|
||||||
while getopts f:W:lhv OPT
|
while getopts f:W:lhv OPT
|
||||||
do
|
do
|
||||||
case ${OPT} in
|
case ${OPT} in
|
||||||
v) version; exit ;;
|
v) version; exit ;;
|
||||||
h) usage; exit ;;
|
h) usage; exit ;;
|
||||||
f) pony="$OPTARG" ;;
|
f) ponies+=( "$OPTARG" ) ;;
|
||||||
l) list; exit ;;
|
l) list; exit ;;
|
||||||
W) wrap="$OPTARG" ;;
|
W) wrap="$OPTARG" ;;
|
||||||
\?) usage >&2; exit 1 ;;
|
\?) usage >&2; exit 1 ;;
|
||||||
|
@ -139,6 +141,10 @@ EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! ${#ponies[@]} == 0 ]]; then
|
||||||
|
pony="${ponies[$RANDOM%${#ponies[@]}]}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -f $pony ]]; then
|
if [[ ! -f $pony ]]; then
|
||||||
# Pony not a file? Search for it
|
# Pony not a file? Search for it
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue