aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG3
-rw-r--r--manuals/ponysay.texinfo28
-rwxr-xr-xponysay41
3 files changed, 64 insertions, 8 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3a747ec..cc46a68 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,9 @@ Version 2.2
Support for colours in the message.
+ Support custom balloon styles using the option '-b', '-B' will list all
+ available. This list depends on whether you are invoking `ponysay` or `ponythink`
+
Version 2.1.1
diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo
index 17ba615..f11b904 100644
--- a/manuals/ponysay.texinfo
+++ b/manuals/ponysay.texinfo
@@ -132,8 +132,10 @@ Show summary of options.
Show version of program.
@item -f PONY
+@itemx --file PONY
@itemx --pony PONY
@cindex @command{-f}
+@cindex @command{--file}
@cindex @command{--pony}
Specify the pony that should printed, this can either be a file name or a pony
name printed by @command{ponysay -l}. This option can be used multiple times to
@@ -145,8 +147,20 @@ If you have @command{util-say} installed, you can use .png-files as the
arguments for this options.
In versions earlier than version 2.0, the if the pony were a file name it had
-to include a `@code{/}'. This is not longer required and any existing file
-supersedes pony names.
+to include a `@code{/}'. This is not longer required and any existing pony name
+supersedes file names.
+
+@item -b STYLE
+@itemx --bubble STYLE
+@itemx --balloon STYLE
+@cindex @command{-b}
+@cindex @command{--bubble}
+@cindex @command{--balloon}
+Specify the balloon style that should used, this can either be a file name or a
+balloon name printed by @command{ponysay -B}. This option can be used multiple
+times to specify a set of styles from which one will be selected randomly. If no
+pony is specified one will be selected randomly. Any existing balloon name
+supersedes file names.
@item -q [PONY...]
@itemx --quote [PONY...]
@@ -185,6 +199,12 @@ is installed the ponies which have quotes, i.e. can be used with the
(depending on the terminal.) This options differs from @command{-l} by
printing alternative names (symbolic links) inside brackets after their
target ponies.
+
+@item -B
+@itemx --balloonlist
+@cindex @command{-B}
+@cindex @command{--balloonlist}
+Prints a list of all balloon styles.
@end table
If neither @command{-q} is used nor any @var{message} is specified, @command{ponysay}
@@ -1043,6 +1063,10 @@ ANSI colour sequences in pony files are applied only to the pony image,
not the balloon link or the balloon itself.
@item
Support for colours in the message.
+@item
+Support custom balloon styles using the option @code{-b}, @code{-B} will list
+all available. This list depends on whether you are invoking @command{ponysay}
+or @command{ponythink}
@end itemize
@heading Version 2.1.1
diff --git a/ponysay b/ponysay
index 708e34d..36b4ca3 100755
--- a/ponysay
+++ b/ponysay
@@ -70,17 +70,17 @@ class Ponysay():
def __getponypath(self, names = None):
ponies = {}
- if not names == None:
- for name in names:
- if os.path.isfile(name):
- ponies[name] = name
-
for ponydir in ponydirs:
for ponyfile in os.listdir(ponydir):
pony = ponyfile[:-5]
if pony not in ponies:
ponies[pony] = ponydir + ponyfile
+ if not names == None:
+ for name in names:
+ if os.path.isfile(name):
+ ponies[name] = name
+
if names == None:
names = list(ponies.keys())
@@ -289,6 +289,35 @@ class Ponysay():
##
'''
+ Returns one file with full path, names is filter for names, also accepts filepaths
+ '''
+ def __getballoonpath(self, names):
+ if names is None:
+ return None
+ balloons = {}
+
+ for balloondir in balloondirs:
+ for balloonfile in os.listdir(balloondir):
+ balloon = balloonfile[:-5]
+ if balloon not in balloons:
+ balloons[balloon] = balloondir + balloonfile
+
+ for name in names:
+ if os.path.isfile(name):
+ balloons[name] = name
+
+ if names == None:
+ names = list(balloons.keys())
+
+ balloon = names[random.randrange(0, len(names))]
+ if balloon not in balloons:
+ sys.stderr.write('That balloon style %s does not exist\n' % (balloon));
+ exit(1)
+ else:
+ return balloons[balloon]
+
+
+ '''
Creates the balloon style object
'''
def __getballoon(self, balloonfile):
@@ -1299,7 +1328,7 @@ pipelinein = not sys.stdin.isatty()
'''
Whether stdout is piped
'''
-pipelineout = False #not sys.stdout.isatty() # currently impossible, we need to get rid of the little shell script first
+pipelineout = not sys.stdout.isatty()
'''
Whether stderr is piped