mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 04:27:58 +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.
|
||||
.TP
|
||||
.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
|
||||
.B \-W \fIcolumn\fP
|
||||
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.
|
||||
.\" See file CREDITS for full list.
|
||||
.PP
|
||||
This manual page was written by Louis Taylor <kragniz@gmail.com>
|
||||
for the Debian project (and may be used by others), and edited
|
||||
by Mattias Andrée <maandree@kth.se>.
|
||||
This manual page was originally written by Louis Taylor <kragniz@gmail.com>
|
||||
for the Debian project (and may be used by others), and edited by
|
||||
Mattias Andrée <maandree@kth.se> for the official ponysay release.
|
||||
.br
|
||||
.PP
|
||||
This program is licensed under WTFPL.
|
||||
|
|
8
ponysay
8
ponysay
|
@ -115,12 +115,14 @@ say() {
|
|||
fi
|
||||
}
|
||||
|
||||
ponies=()
|
||||
|
||||
while getopts f:W:lhv OPT
|
||||
do
|
||||
case ${OPT} in
|
||||
v) version; exit ;;
|
||||
h) usage; exit ;;
|
||||
f) pony="$OPTARG" ;;
|
||||
f) ponies+=( "$OPTARG" ) ;;
|
||||
l) list; exit ;;
|
||||
W) wrap="$OPTARG" ;;
|
||||
\?) usage >&2; exit 1 ;;
|
||||
|
@ -139,6 +141,10 @@ EOF
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! ${#ponies[@]} == 0 ]]; then
|
||||
pony="${ponies[$RANDOM%${#ponies[@]}]}"
|
||||
fi
|
||||
|
||||
if [[ ! -f $pony ]]; then
|
||||
# Pony not a file? Search for it
|
||||
|
||||
|
|
Loading…
Reference in a new issue