From 99ddfe9cd38bdfd6ba9f66d69dbf92cbb0afb627 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 03:51:34 +0200 Subject: separate colouring for pony, balloon and link --- ponysay | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/ponysay b/ponysay index 3a4efa3..a843572 100755 --- a/ponysay +++ b/ponysay @@ -1092,27 +1092,76 @@ class ColourStack(): self.bufproto = ' ' * (self.lenpush if self.lenpush > self.lenpop else self.lenpop) self.stack = [] self.push() + self.seq = None def push(self): - self.stack = [[self.bufproto]] + self.stack + self.stack = [[self.bufproto, None, None, [False] * 9]] + self.stack if len(self.stack) == 1: - return '' - return '' + return None + old = self.stack[1] + rc = '\033[' + if old[1] is not None: rc += '39;' + if old[2] is not None: rc += '49;' + for i in range(0, 9): + if old[3][i]: + rc += '2%i;' % (i + 1) + return '' if len(rc) == 2 else (rc[:-1] + 'm') def pop(self): - return '' + old = self.stack[0] + self.stack = self.stack[1:] + rc = '\033[' + if old[1] is not None: rc += '39;' + if old[2] is not None: rc += '49;' + for i in range(0, 9): + if old[3][i]: + rc += str(i + 21) + ';' + new = self.stack[0] + if new[1] is not None: rc += new[1] + ';' + if new[2] is not None: rc += new[2] + ';' + for i in range(0, 9): + if new[3][i]: + rc += str(i + 1) + ';' + return '' if len(rc) == 2 else (rc[:-1] + 'm') def feed(self, char): + if self.seq is not None: + self.seq += char + if (char == '~') or (('a' <= char) and (char <= 'z')) or (('A' <= char) and (char <= 'Z')): + if (self.seq[0] == '[') and (self.seq[-1] == 'm'): + self.seq = self.seq[1:-1].split(';') + (i, n) = (0, len(self.seq)) + while i < n: + part = self.seq[i] + p = 0 if part == '' else int(part) + i += 1 + if p == '': self.stack[0][1:] = [None, None, [False] * 9] + elif (1 <= p) and (p <= 9): self.stack[0][3][p - 1] = True + elif (21 <= p) and (p <= 29): self.stack[0][3][p - 21] = False + elif p == 39: self.stack[0][1] = None + elif p == 40: self.stack[0][2] = None + elif (30 <= p) and (p <= 37): self.stack[0][1] = part + elif (90 <= p) and (p <= 97): self.stack[0][1] = part + elif (40 <= p) and (p <= 47): self.stack[0][2] = part + elif (100 <= p) and (p <= 107): self.stack[0][2] = part + elif p == 38: + self.stack[0][1] = '%s;%s;%s' % (part, self.seq[i], self.seq[i + 1]) + i += 2 + elif p == 48: + self.stack[0][2] = '%s;%s;%s' % (part, self.seq[i], self.seq[i + 1]) + i += 2 + self.seq = None + elif char == '\033': + self.seq = '' buf = self.stack[0][0] + buf = buf[1:] + char rc = '' - if buf[:-self.lenpush] == self.autopush: - rc = self.push() - elif buf[:-self.lenpop] == self.autopop: - rc = self.pop() - self.stack[0][0] = buf[1:] + char + if buf[-self.lenpush:] == self.autopush: rc = self.push() + elif buf[-self.lenpop:] == self.autopop: rc = self.pop() + self.stack[0][0] = buf return rc -- cgit From 24a3c06ea4ca7ebdbb709b226482ff7a5739f48a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 03:55:51 +0200 Subject: change log update --- CHANGELOG | 8 ++++++++ manuals/ponysay.texinfo | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 1c473c9..f87bb6f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +Version 2.2 + + Full support for arbitrary positioning of balloon in pony files. + + ANSI colour sequences in pony files are applied only to the pony image, + not the balloon link or the balloon itself. + + Version 2.1.1 Nothing worth mentioning. diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index bc2989b..cbf63b1 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -8,7 +8,7 @@ @documentlanguage en @finalout @c %**end of header -@set VERSION 2.1.1 +@set VERSION 2.2 @copying This manual is for ponysay @@ -1033,6 +1033,16 @@ first pony file in common. @cindex versions @cindex previous releases +@heading Version 2.2 + +@itemize @bullet +@item +Full support for arbitrary positioning of balloon in pony files. +@item +ANSI colour sequences in pony files are applied only to the pony image, +not the balloon link or the balloon itself. +@end itemize + @heading Version 2.1.1 Nothing worth mention. -- cgit From 52fe45889ad432917336d2eb72397aa6ebd11c82 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 04:34:56 +0200 Subject: balloon style files --- balloons/ascii.say | 30 ++++++++++++++++++++++++++++++ balloons/ascii.think | 30 ++++++++++++++++++++++++++++++ balloons/cowsay.say | 25 +++++++++++++++++++++++++ balloons/cowsay.think | 25 +++++++++++++++++++++++++ balloons/linux-vt.say | 35 +++++++++++++++++++++++++++++++++++ balloons/round.say | 35 +++++++++++++++++++++++++++++++++++ balloons/unicode.say | 35 +++++++++++++++++++++++++++++++++++ balloons/unicode.think | 25 +++++++++++++++++++++++++ 8 files changed, 240 insertions(+) create mode 100644 balloons/ascii.say create mode 100644 balloons/ascii.think create mode 100644 balloons/cowsay.say create mode 100644 balloons/cowsay.think create mode 100644 balloons/linux-vt.say create mode 100644 balloons/round.say create mode 100644 balloons/unicode.say create mode 100644 balloons/unicode.think diff --git a/balloons/ascii.say b/balloons/ascii.say new file mode 100644 index 0000000..1a9d014 --- /dev/null +++ b/balloons/ascii.say @@ -0,0 +1,30 @@ +/:/ +\:\ + +n:_ +: +s:_ +w:| +e: | + +ww:| +ee: | + +nw: +:/ +ne: +:\ +sw:\ +se:/ + +nnw:_ +: +nne:_ +: +ssw:_ +sse:_ + +nww:| +nee: | +sww:| +see: | diff --git a/balloons/ascii.think b/balloons/ascii.think new file mode 100644 index 0000000..56591d2 --- /dev/null +++ b/balloons/ascii.think @@ -0,0 +1,30 @@ +/:o +\:o + +n:_ +: +s:_ +w:( +e: ) + +ww:( +ee: ) + +nw: +:( +ne: +:) +sw:( +se:) + +nnw:_ +: +nne:_ +: +ssw:_ +sse:_ + +nww:( +nee: ) +sww:( +see: ) diff --git a/balloons/cowsay.say b/balloons/cowsay.say new file mode 100644 index 0000000..827183e --- /dev/null +++ b/balloons/cowsay.say @@ -0,0 +1,25 @@ +/:/ +\:\ + +n:_ +s:- +w:| +e: | + +ww:< +ee:> + +nw: _ +ne:_ +sw: - +se:- + +nnw:_ +nne:_ +ssw:- +sse:- + +nww:/ +nee:\ +sww:\ +see:/ diff --git a/balloons/cowsay.think b/balloons/cowsay.think new file mode 100644 index 0000000..1450bc7 --- /dev/null +++ b/balloons/cowsay.think @@ -0,0 +1,25 @@ +/:o +\:o + +n:_ +s:- +w:( +e: ) + +ww:( +ee: ) + +nw: _ +ne:_ +sw: - +se:- + +nnw:_ +nne:_ +ssw:- +sse:- + +nww:( +nee: ) +sww:( +see: ) diff --git a/balloons/linux-vt.say b/balloons/linux-vt.say new file mode 100644 index 0000000..69a14ae --- /dev/null +++ b/balloons/linux-vt.say @@ -0,0 +1,35 @@ +/:/ +\:\ + +n:─ +: +s: +:─ +w:│ +e: │ + +ww:│ +ee: │ + +nw:┌ +:│ +ne:┐ +:│ +sw:│ +:└ +se:│ +:┘ + +nnw:─ +: +nne:─ +: +ssw: +:─ +sse: +:─ + +nww:│ +nee: │ +sww:│ +see: │ diff --git a/balloons/round.say b/balloons/round.say new file mode 100644 index 0000000..01ef456 --- /dev/null +++ b/balloons/round.say @@ -0,0 +1,35 @@ +/:╱ +\:╲ + +n:─ +: +s: +:─ +w:│ +e: │ + +ww:│ +ee: │ + +nw:╭ +:│ +ne:╮ +:│ +sw:│ +:╰ +se:│ +:╯ + +nnw:─ +: +nne:─ +: +ssw: +:─ +sse: +:─ + +nww:│ +nee: │ +sww:│ +see: │ diff --git a/balloons/unicode.say b/balloons/unicode.say new file mode 100644 index 0000000..a67a7f8 --- /dev/null +++ b/balloons/unicode.say @@ -0,0 +1,35 @@ +/:╱ +\:╲ + +n:─ +: +s: +:─ +w:│ +e: │ + +ww:│ +ee: │ + +nw:┌ +:│ +ne:┐ +:│ +sw:│ +:└ +se:│ +:┘ + +nnw:─ +: +nne:─ +: +ssw: +:─ +sse: +:─ + +nww:│ +nee: │ +sww:│ +see: │ diff --git a/balloons/unicode.think b/balloons/unicode.think new file mode 100644 index 0000000..fba4c51 --- /dev/null +++ b/balloons/unicode.think @@ -0,0 +1,25 @@ +/:o +\:o + +n:⁀ +s:‿ +w:( +e: ) + +ww:( +ee: ) + +nw:) +ne:( +sw:) +se:( + +nnw:⁀ +nne:⁀ +ssw:‿ +sse:‿ + +nww:( +nee: ) +sww:( +see: ) -- cgit From 6088f793691f22c5308e9435f91a12c4c3869f7e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 04:45:05 +0200 Subject: never wrap less than 8 --- ponysay | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ponysay b/ponysay index a843572..1f99579 100755 --- a/ponysay +++ b/ponysay @@ -958,6 +958,8 @@ class Backend(): wrap = None if self.wrapcolumn is not None: wrap = self.wrapcolumn - left + if wrap < 8: + wrap = 8 msg = self.message if wrap is not None: -- cgit From 4a55d12917eea7edb0d9d49c8d9b0564a9cbbcba Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 13:15:01 +0200 Subject: change log update --- CHANGELOG | 2 ++ manuals/ponysay.texinfo | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f87bb6f..3a747ec 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,8 @@ Version 2.2 ANSI colour sequences in pony files are applied only to the pony image, not the balloon link or the balloon itself. + Support for colours in the message. + Version 2.1.1 diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index cbf63b1..17ba615 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -1041,6 +1041,8 @@ Full support for arbitrary positioning of balloon in pony files. @item 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. @end itemize @heading Version 2.1.1 -- cgit From 16763d07d3296afb651adc524ded365dc3efa005 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 14:36:01 +0200 Subject: balloon class used for balloon style customisation --- ponysay | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/ponysay b/ponysay index 1f99579..a5b6030 100755 --- a/ponysay +++ b/ponysay @@ -683,6 +683,51 @@ class ArgParser(): +''' +Balloon format class +''' +class Balloon(): + ''' + Constructor + ''' + def __init__(self, link, linkmirror, ww, ee, nw, nnw, n, nne, ne, nee, e, see, se, sse, s, ssw, sw, sww, w, nww): + (self.link, self.linkmirror) = (link, linkmirror) + (self.ww, self.ee) = (ww, ee) + (self.nw, self.ne, self.se, self.sw) = (nw, ne, se, sw) + (self.nnw, self.n, self.nne) = (nnw, n, nne) + (self.nee, self.e, self.see) = (nee, e, see) + (self.sse, self.s, self.ssw) = (sse, s, ssw) + (self.sww, self.w, self.nww) = (sww, w, nww) + + minE = len(max([ne, nee, e, see, se, ee], key = len)) + minW = len(max([nw, nww, e, sww, sw, ww], key = len)) + minN = len(max([ne, nne, n, nnw, nw], key = len)) + minS = len(max([se, sse, s, ssw, sw], key = len)) + + self.minwidth = minE + minE + self.minheight = minN + minS + + + ''' + Generates a balloon with a message + ''' + def get(self, minw, minh, lines, lencalc): + h = 4 + lencalc(lines) + w = 6 + lencalc(max(lines, key = lencalc)) + if w < minw: w = minw + if h < minh: h = minh + + rc = '/' + '-' * (w - 2) + '\\\n' + rc += '|' + ' ' * (w - 2) + '|\n' + for line in lines: + rc += '| ' + line + ' ' * (w - lencalc(line) - 6) + ' |\n' + rc += '|' + ' ' * (w - 2) + '|\n' + rc += '\\' + '-' * (w - 2) + '/' + + return rc + + + ''' Replacement for cowsay ''' @@ -697,7 +742,12 @@ class Backend(): self.wrapcolumn = wrapcolumn self.width = width - self.link = {'\\' : '\\', '/' : '/'} if not isthink else {'\\' : 'o', '/' : 'o'} + if isthink: + self.balloon = Balloon('o', 'o', '( ', ' )', [' _'], ['_'], ['_'], ['_'], ['_ '], ' )', ' )', ' )', ['- '], ['-'], ['-'], ['-'], ['- '], '( ', '( ', '( ') + else: + self.balloon = Balloon('\\', '/', '< ', ' >', [' _'], ['_'], ['_'], ['_'], ['_ '], ' \\', ' |', ' //', ['- '], ['-'], ['-'], ['-'], ['- '], '\\ ', '| ', '/ ') + + self.link = {'\\' : self.balloon.link, '/' : self.balloon.linkmirror} self.output = '' self.pony = None @@ -965,19 +1015,8 @@ class Backend(): if wrap is not None: msg = self.__wrapMessage(msg, wrap) lines = msg.split('\n') - h = 4 + len(lines) - w = 6 + len(max(lines, key = len)) - if w < width: w = width - if h < height: h = height - rc = '/' + '-' * (w - 2) + '\\\n' - rc += '|' + ' ' * (w - 2) + '|\n' - for line in lines: - rc += '| ' + line + ' ' * (w - len(line) - 6) + ' |\n' - rc += '|' + ' ' * (w - 2) + '|\n' - rc += '\\' + '-' * (w - 2) + '/' - - return rc + return self.balloon.get(width, height, lines, self.__len) ''' -- cgit From 3f137a105514d1ae12374d0b4475438c31b21983 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 14:55:09 +0200 Subject: balloons are customisable (but there is not yet a way to do that) --- ponysay | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/ponysay b/ponysay index a5b6030..b1fbd27 100755 --- a/ponysay +++ b/ponysay @@ -699,8 +699,13 @@ class Balloon(): (self.sse, self.s, self.ssw) = (sse, s, ssw) (self.sww, self.w, self.nww) = (sww, w, nww) - minE = len(max([ne, nee, e, see, se, ee], key = len)) - minW = len(max([nw, nww, e, sww, sw, ww], key = len)) + _ne = max(ne, key = len) + _nw = max(nw, key = len) + _se = max(se, key = len) + _sw = max(sw, key = len) + + minE = len(max([_ne, nee, e, see, _se, ee], key = len)) + minW = len(max([_nw, nww, e, sww, _sw, ww], key = len)) minN = len(max([ne, nne, n, nnw, nw], key = len)) minS = len(max([se, sse, s, ssw, sw], key = len)) @@ -712,19 +717,31 @@ class Balloon(): Generates a balloon with a message ''' def get(self, minw, minh, lines, lencalc): - h = 4 + lencalc(lines) - w = 6 + lencalc(max(lines, key = lencalc)) + h = self.minheight + len(lines) + w = self.minwidth + lencalc(max(lines, key = lencalc)) if w < minw: w = minw if h < minh: h = minh - rc = '/' + '-' * (w - 2) + '\\\n' - rc += '|' + ' ' * (w - 2) + '|\n' - for line in lines: - rc += '| ' + line + ' ' * (w - lencalc(line) - 6) + ' |\n' - rc += '|' + ' ' * (w - 2) + '|\n' - rc += '\\' + '-' * (w - 2) + '/' + rc = [] - return rc + for j in range(0, len(self.n)): + rc.append(self.nw[j] + self.n[j] * (w - len(self.nw[j]) - len(self.ne[j])) + self.ne[j]) + + if len(lines) > 1: + (ws, es) = ({0 : self.nww, len(lines) - 1 : self.sww}, {0 : self.nee, len(lines) - 1 : self.see}) + for j in range(1, len(lines) - 1): + ws[j] = self.w + es[j] = self.e + else: + (ws, es) = ({0 : self.ww}, {0 : self.ee}) + + for j in range(0, len(lines)): + rc.append(ws[j] + lines[j] + ' ' * (w - lencalc(lines[j]) - len(self.w) - len(self.e)) + es[j]) + + for j in range(0, len(self.s)): + rc.append(self.sw[j] + self.s[j] * (w - len(self.sw[j]) - len(self.se[j])) + self.se[j]) + + return '\n'.join(rc) @@ -743,9 +760,9 @@ class Backend(): self.width = width if isthink: - self.balloon = Balloon('o', 'o', '( ', ' )', [' _'], ['_'], ['_'], ['_'], ['_ '], ' )', ' )', ' )', ['- '], ['-'], ['-'], ['-'], ['- '], '( ', '( ', '( ') + self.balloon = Balloon('o', 'o', '( ', ' )', [' _'], ['_'], ['_'], ['_'], ['_ '], ' )', ' )', ' )', ['- '], ['-'], ['-'], ['-'], [' -'], '( ', '( ', '( ') else: - self.balloon = Balloon('\\', '/', '< ', ' >', [' _'], ['_'], ['_'], ['_'], ['_ '], ' \\', ' |', ' //', ['- '], ['-'], ['-'], ['-'], ['- '], '\\ ', '| ', '/ ') + self.balloon = Balloon('\\', '/', '< ', ' >', [' _'], ['_'], ['_'], ['_'], ['_ '], ' \\', ' |', ' /', ['- '], ['-'], ['-'], ['-'], [' -'], '\\ ', '| ', '/ ') self.link = {'\\' : self.balloon.link, '/' : self.balloon.linkmirror} -- cgit From 1524a8d07bd3ce583e5e5bea4b9390c52d0ef3fa Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 14:57:24 +0200 Subject: balloon correction --- balloons/cowsay.say | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/balloons/cowsay.say b/balloons/cowsay.say index 827183e..bb486db 100644 --- a/balloons/cowsay.say +++ b/balloons/cowsay.say @@ -7,7 +7,7 @@ w:| e: | ww:< -ee:> +ee: > nw: _ ne:_ @@ -19,7 +19,7 @@ nne:_ ssw:- sse:- -nww:/ -nee:\ -sww:\ -see:/ +nww:/ +nee: \ +sww:\ +see: / -- cgit From ef624440a8acbbbdb8ec33612aba36619b636140 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 15:03:34 +0200 Subject: improved balloon customisation --- ponysay | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/ponysay b/ponysay index b1fbd27..a29a8e7 100755 --- a/ponysay +++ b/ponysay @@ -722,11 +722,6 @@ class Balloon(): if w < minw: w = minw if h < minh: h = minh - rc = [] - - for j in range(0, len(self.n)): - rc.append(self.nw[j] + self.n[j] * (w - len(self.nw[j]) - len(self.ne[j])) + self.ne[j]) - if len(lines) > 1: (ws, es) = ({0 : self.nww, len(lines) - 1 : self.sww}, {0 : self.nee, len(lines) - 1 : self.see}) for j in range(1, len(lines) - 1): @@ -735,11 +730,26 @@ class Balloon(): else: (ws, es) = ({0 : self.ww}, {0 : self.ee}) + rc = [] + + for j in range(0, len(self.n)): + outer = len(self.nw[j]) + len(self.ne[j]) + inner = len(self.nnw[j]) + len(self.nne[j]) + if outer + inner >= w: + rc.append(self.nw[j] + self.nnw[j] + self.n[j] * (w - outer - inner) + self.nne[j] + self.ne[j]) + else: + rc.append(self.nw[j] + self.n[j] * (w - outer) + self.ne[j]) + for j in range(0, len(lines)): rc.append(ws[j] + lines[j] + ' ' * (w - lencalc(lines[j]) - len(self.w) - len(self.e)) + es[j]) for j in range(0, len(self.s)): - rc.append(self.sw[j] + self.s[j] * (w - len(self.sw[j]) - len(self.se[j])) + self.se[j]) + outer = len(self.sw[j]) + len(self.se[j]) + inner = len(self.ssw[j]) + len(self.sse[j]) + if outer + inner >= w: + rc.append(self.sw[j] + self.ssw[j] + self.s[j] * (w - outer - inner) + self.sse[j] + self.se[j]) + else: + rc.append(self.sw[j] + self.s[j] * (w - outer) + self.se[j]) return '\n'.join(rc) -- cgit From a033501244ae238055f309d0edc3769ee6cbbf14 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 15:57:48 +0200 Subject: balloon style parsing --- ponysay | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/ponysay b/ponysay index a29a8e7..708e34d 100755 --- a/ponysay +++ b/ponysay @@ -283,6 +283,48 @@ class Ponysay(): print(pony) + + ## + ## Balloon methods + ## + + ''' + Creates the balloon style object + ''' + def __getballoon(self, balloonfile): + if balloonfile is None: + if isthink: + return Balloon('o', 'o', '( ', ' )', [' _'], ['_'], ['_'], ['_'], ['_ '], ' )', ' )', ' )', ['- '], ['-'], ['-'], ['-'], [' -'], '( ', '( ', '( ') + return Balloon('\\', '/', '< ', ' >', [' _'], ['_'], ['_'], ['_'], ['_ '], ' \\', ' |', ' /', ['- '], ['-'], ['-'], ['-'], [' -'], '\\ ', '| ', '/ ') + + map = {} + for elem in ('\\', '/', 'ww', 'ee', 'nw', 'nnw', 'n', 'nne', 'ne', 'nee', 'e', 'see', 'se', 'sse', 's', 'ssw', 'sw', 'sww', 'w', 'nww'): + map[elem] = [] + + balloonstream = None + try: + balloonstream = open(balloonfile, 'r') + data = [line.replace('\n', '') for line in balloonstream.readlines()] + finally: + if balloonstream is not None: + balloonstream.close() + + last = None + for line in data: + if len(line) > 0: + if line[0] == ':': + map[last].append(line[1:]) + else: + last = line[:line.index(':')] + value = line[len(last) + 1:] + map[last].append(value) + + return Balloon(map['\\'][0], map['/'][0], map['ww'][0], map['ee'][0], map['nw'], map['nnw'], map['n'], + map['nne'], map['ne'], map['nee'][0], map['e'][0], map['see'][0], map['se'], map['sse'], + map['s'], map['ssw'], map['sw'], map['sww'][0], map['w'][0], map['nww'][0]) + + + ## ## Displaying methods ## @@ -323,7 +365,7 @@ class Ponysay(): widthtruncation = self.__gettermsize()[1] if env_width not in ('yes', 'y', '1') else None messagewrap = int(args.opts['-W'][0]) if args.opts['-W'] is not None else None - backend = Backend(message = msg, ponyfile = pony, wrapcolumn = messagewrap if messagewrap is not None else 40, width = widthtruncation) + backend = Backend(message = msg, ponyfile = pony, wrapcolumn = messagewrap if messagewrap is not None else 40, width = widthtruncation, balloon = self.__getballoon(None)) backend.parse() output = backend.output if (len(output) > 0) and (output[-1] == '\n'): @@ -649,7 +691,7 @@ class ArgParser(): if first: first = False else: - print(' or', end="") + print(' or', end='') print('\t%s' % (line)) print() @@ -761,18 +803,14 @@ Replacement for cowsay class Backend(): ''' Constructor - Takes message [string], ponyfile [filename string], wrapcolumn [None or an int] and width [None or an int] + Takes message [string], ponyfile [filename string], wrapcolumn [None or an int], width [None or an int] and balloon [Balloon object] ''' - def __init__(self, message, ponyfile, wrapcolumn, width): + def __init__(self, message, ponyfile, wrapcolumn, width, balloon): self.message = message self.ponyfile = ponyfile self.wrapcolumn = wrapcolumn self.width = width - - if isthink: - self.balloon = Balloon('o', 'o', '( ', ' )', [' _'], ['_'], ['_'], ['_'], ['_ '], ' )', ' )', ' )', ['- '], ['-'], ['-'], ['-'], [' -'], '( ', '( ', '( ') - else: - self.balloon = Balloon('\\', '/', '< ', ' >', [' _'], ['_'], ['_'], ['_'], ['_ '], ' \\', ' |', ' /', ['- '], ['-'], ['-'], ['-'], [' -'], '\\ ', '| ', '/ ') + self.balloon = balloon self.link = {'\\' : self.balloon.link, '/' : self.balloon.linkmirror} @@ -955,7 +993,7 @@ class Backend(): datalen = self.__len(data) skip += datalen nonskip += datalen - data = data.replace("$", '$$') + data = data.replace('$', '$$') n += len(data) self.pony = self.pony[:i] + data + self.pony[i:] balloonLines[balloonLine] = None @@ -1325,9 +1363,9 @@ opts.add_argumentless(['-h', '--help'], help = 'Print this opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.') opts.add_argumentless(['-l', '--list'], help = 'List pony files.') opts.add_argumentless(['-L', '--altlist'], help = 'List pony files with alternatives.') -opts.add_argumented( ['-W', '--wrap'], arg = "COLUMN", help = 'Specify the column when the message should be wrapped.') -opts.add_argumented( ['-f', '--pony'], arg = "PONY", help = 'Select a pony.\nEither a file name or a pony name.') -opts.add_variadic( ['-q', '--quote'], arg = "PONY", help = 'Select a ponies which will quote themself.') +opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.') +opts.add_argumented( ['-f', '--pony'], arg = 'PONY', help = 'Select a pony.\nEither a file name or a pony name.') +opts.add_variadic( ['-q', '--quote'], arg = 'PONY', help = 'Select a ponies which will quote themself.') opts.parse() -- cgit From 2934997c06b582dbbd7730555c9eecf817e5a035 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 16:01:05 +0200 Subject: balloon file fix --- balloons/unicode.think | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/balloons/unicode.think b/balloons/unicode.think index fba4c51..005e545 100644 --- a/balloons/unicode.think +++ b/balloons/unicode.think @@ -9,10 +9,10 @@ e: ) ww:( ee: ) -nw:) -ne:( -sw:) -se:( +nw:( +ne:) +sw:( +se:) nnw:⁀ nne:⁀ -- cgit From 504a6bd5f5a13d19fee54fcbec537bdab983e2ba Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 16:20:29 +0200 Subject: balloon stuff + pony names supersedes file names --- CHANGELOG | 3 +++ manuals/ponysay.texinfo | 28 ++++++++++++++++++++++++++-- ponysay | 41 +++++++++++++++++++++++++++++++++++------ 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()) @@ -288,6 +288,35 @@ class Ponysay(): ## Balloon methods ## + ''' + 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 ''' @@ -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 -- cgit From b66b3b5bfc842b1224c5b6bcd2f0c6737f2f0f8b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 16:21:35 +0200 Subject: in case you want to run `ponysay -l | less -r` --- ponysay | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ponysay b/ponysay index 36b4ca3..a329fd5 100755 --- a/ponysay +++ b/ponysay @@ -46,10 +46,6 @@ class Ponysay(): args.help() return - if (args.opts['-l'] is not None) and pipelineout: - args.opts['--onelist'] = args.opts['-l'] - args.opts['-l'] = None - if args.opts['-h'] is not None: args.help() elif args.opts['--quoters'] is not None: self.quoters() elif args.opts['--onelist'] is not None: self.onelist() -- cgit From 66cbb352ebc7717f9bbd816b6e76bdcc347fdcb7 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 17:26:21 +0200 Subject: balloon styles: -b and -B options are implemented --- completion/bash-completion.sh | 6 +- completion/fish-completion.fish | 9 ++- completion/zsh-completion.zsh | 8 ++- configure | 2 +- manuals/ponysay.texinfo | 3 +- ponysay | 129 ++++++++++++++++++++++++++++++---------- 6 files changed, 116 insertions(+), 41 deletions(-) diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index d790786..72cafcb 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -5,7 +5,7 @@ _ponysay() local cur prev words cword _init_completion -n = || return - options='--version --help --list --altlist --pony --wrap --quote' + options='--version --help --list --altlist --pony --wrap --quote --balloonlist --balloon' COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) if [ $prev = "-f" ] || [ $prev = "--pony" ]; then @@ -16,6 +16,10 @@ _ponysay() quoters=$('/usr/bin/ponysay' --quoters) COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) ) + elif [ $prev = "-b" ] || [ $prev = "--balloon" ]; then + balloons=$('/usr/bin/ponysay' --balloonlist) + COMPREPLY=( $( compgen -W "$balloons" -- "$cur" ) ) + elif [ $prev = "-W" ] || [ $prev = "--wrap" ]; then cols=$(( `stty size | cut -d ' ' -f 2` - 10 )) COMPREPLY=( $cols $(( $cols / 2 )) 100 60 ) diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish index 9233c67..ead664b 100644 --- a/completion/fish-completion.fish +++ b/completion/fish-completion.fish @@ -5,17 +5,20 @@ set -g ponies ('/usr/bin/ponysay' --onelist) set -g quoters ('/usr/bin/ponysay' --quoters) +set -g balloons ('/usr/bin/ponysay' --balloonlist) complete --command ponysay --short-option h --long-option help --description 'help of ponysay' complete --command ponysay --short-option v --long-option version --description 'version of ponysay' -complete --command ponysay --short-option l --long-option list --description 'list pony files' -complete --command ponysay --short-option L --long-option altlist --description 'list pony files with alternatives' +complete --command ponysay --short-option l --long-option list --description 'list pony names' +complete --command ponysay --short-option L --long-option altlist --description 'list pony names with alternatives' +complete --command ponysay --short-option B --long-option balloonlist --description 'list balloon style names' complete --command ponysay --short-option f --long-option pony --arguments "$ponies" --description 'pony' complete --command ponysay --short-option q --long-option quote --arguments "$quoters" --no-files --description 'pony' +complete --command ponysay --short-option b --long-option balloon --arguments "$balloons" --description 'balloon style' complete --command ponysay --short-option W --long-option wrap --arguments 'Integer' --description 'specify the column when the message should be wrapped' complete --command ponysay --arguments 'MESSAGE' set -e ponies set -e quoters - +set -e balloons diff --git a/completion/zsh-completion.zsh b/completion/zsh-completion.zsh index 2124380..c19604d 100644 --- a/completion/zsh-completion.zsh +++ b/completion/zsh-completion.zsh @@ -2,10 +2,12 @@ _shortopts=( '-v[Show version and exit]' '-h[Show this help and exit]' - '-l[list ponyfiles]' - '-L[list ponyfiles with alternatives]' - '-f[Select a pony (either a filename or a ponyname]: :_path_files -W '/usr/share/ponysay/ponies' -g "*(\:r)"' + '-l[list pony names]' + '-L[list pony names with alternatives]' + '-B[list balloon style names]' + '-f[Select a pony (either a file name or a pony name]: :_path_files -W '/usr/share/ponysay/ponies' -g "*(\:r)"' '-q[Select ponies for MLP:FiM quotes]' + '-b[Selecy a balloon style]' '-W[The screen column where the message should be wrapped]' ) _arguments -s : \ diff --git a/configure b/configure index 0629006..6cde35b 100755 --- a/configure +++ b/configure @@ -6,7 +6,7 @@ INFODESC=\''My Little Ponies for your terminal'\' SHELL='bash' completions='completion/bash-completion.sh completion/fish-completion.fish completion/zsh-completion.zsh' -shareDirs='ponies ttyponies quotes' +shareDirs='ponies ttyponies quotes balloons' manFiles='manuals/manpage.6 manuals/manpage.es.6' licenseFiles='COPYING' diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index f11b904..d0a9cfb 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -159,8 +159,7 @@ supersedes file names. 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. +balloon style is specified a fallback style will be used. @item -q [PONY...] @itemx --quote [PONY...] diff --git a/ponysay b/ponysay index a329fd5..fedaab6 100755 --- a/ponysay +++ b/ponysay @@ -52,6 +52,7 @@ class Ponysay(): elif args.opts['-v'] is not None: self.version() elif args.opts['-l'] is not None: self.list() elif args.opts['-L'] is not None: self.linklist() + elif args.opts['-B'] is not None: self.balloonlist() elif args.opts['-q'] is not None: self.quote(args) else: self.print_pony(args) @@ -61,7 +62,7 @@ class Ponysay(): ## ''' - Returns one file with full path, names is filter for names, also accepts filepaths. + Returns one file with full path, names is filter for names, also accepts filepaths ''' def __getponypath(self, names = None): ponies = {} @@ -160,10 +161,13 @@ class Ponysay(): quoters = self.__quoters() for ponydir in ponydirs: # Loop ponydirs - print('\033[1mponyfiles located in ' + ponydir + '\033[21m') + print('\033[1mponies located in ' + ponydir + '\033[21m') - ponies = os.listdir(ponydir) - ponies = [item[:-5] for item in ponies] # remove .pony from file name + _ponies = os.listdir(ponydir) + ponies = [] + for pony in _ponies: + if (len(pony) > 5) and (pony[-5:] == '.pony'): + ponies.append(pony[:-5]) ponies.sort() width = len(max(ponies, key = len)) + 2 # Get the longest ponyfilename lenght + 2 spaces @@ -176,7 +180,7 @@ class Ponysay(): if x > (termsize[1] - width): # If too wide, make new line print() x = 0 - + print('\n'); @@ -188,12 +192,15 @@ class Ponysay(): quoters = self.__quoters() for ponydir in ponydirs: # Loop ponydirs - print('\033[1mponyfiles located in ' + ponydir + '\033[21m') + print('\033[1mponies located in ' + ponydir + '\033[21m') - files = os.listdir(ponydir) - files = [item[:-5] for item in files] # remove .pony from file name - files.sort() - pairs = [(item, os.readlink(ponydir + item + '.pony') if os.path.islink(ponydir + item + '.pony') else '') for item in files] + _ponies = os.listdir(ponydir) + ponies = [] + for pony in _ponies: + if (len(pony) > 5) and (pony[-5:] == '.pony'): + ponies.append(pony[:-5]) + ponies.sort() + pairs = [(pony, os.readlink(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else '') for pony in ponies] ponymap = {} for pair in pairs: @@ -239,7 +246,7 @@ class Ponysay(): for pony in ponies: spacing = ' ' * (width - widths[index]) index += 1 - print(pony + spacing, end='') # Print ponyfilename + print(pony + spacing, end='') # Print pony file name x += width if x > (termsize[1] - width): # If too wide, make new line print() @@ -268,10 +275,13 @@ class Ponysay(): ''' def onelist(self): last = '' - ponies = [] + _ponies = [] for ponydir in ponydirs: # Loop ponydirs - ponies += os.listdir(ponydir) - ponies = [item[:-5] for item in ponies] # remove .pony from file name + _ponies += os.listdir(ponydir) + ponies = [] + for pony in _ponies: + if (len(pony) > 5) and (pony[-5:] == '.pony'): + ponies.append(pony[:-5]) ponies.sort() for pony in ponies: if not pony == last: @@ -285,7 +295,42 @@ class Ponysay(): ## ''' - Returns one file with full path, names is filter for names, also accepts filepaths + Prints a list of all balloons + ''' + def balloonlist(self): + termsize = self.__gettermsize() + balloonset = set() + + for balloondir in balloondirs: + for balloon in os.listdir(balloondir): + if isthink and (len(balloon) > 6) and (balloon[-6:] == '.think'): + balloon = balloon[:-6] + elif (not isthink) and (len(balloon) > 4) and (balloon[-4:] == '.say'): + balloon = balloon[:-4] + else: + continue + if balloon not in balloonset: + balloonset.add(balloon) + + balloons = list(balloonset) + balloons.sort() + + width = len(max(balloons, key = len)) + 2 + + x = 0 + for balloon in balloons: + spacing = ' ' * (width - len(balloon)) + print(balloon + spacing, end='') + x += width + if x > (termsize[1] - width): + print() + x = 0 + + print(); + + + ''' + Returns one file with full path, names is filter for style names, also accepts filepaths ''' def __getballoonpath(self, names): if names is None: @@ -293,8 +338,14 @@ class Ponysay(): balloons = {} for balloondir in balloondirs: - for balloonfile in os.listdir(balloondir): - balloon = balloonfile[:-5] + for balloon in os.listdir(balloondir): + balloonfile = balloon + if isthink and (len(balloon) > 6) and (balloon[-6:] == '.think'): + balloon = balloon[:-6] + elif (not isthink) and (len(balloon) > 4) and (balloon[-4:] == '.say'): + balloon = balloon[:-4] + else: + continue if balloon not in balloons: balloons[balloon] = balloondir + balloonfile @@ -390,7 +441,9 @@ class Ponysay(): widthtruncation = self.__gettermsize()[1] if env_width not in ('yes', 'y', '1') else None messagewrap = int(args.opts['-W'][0]) if args.opts['-W'] is not None else None - backend = Backend(message = msg, ponyfile = pony, wrapcolumn = messagewrap if messagewrap is not None else 40, width = widthtruncation, balloon = self.__getballoon(None)) + balloon = self.__getballoon(self.__getballoonpath(args.opts['-b'])) + + backend = Backend(message = msg, ponyfile = pony, wrapcolumn = messagewrap if messagewrap is not None else 40, width = widthtruncation, balloon = balloon) backend.parse() output = backend.output if (len(output) > 0) and (output[-1] == '\n'): @@ -1269,7 +1322,7 @@ class ColourStack(): part = self.seq[i] p = 0 if part == '' else int(part) i += 1 - if p == '': self.stack[0][1:] = [None, None, [False] * 9] + if p == 0: self.stack[0][1:] = [None, None, [False] * 9] elif (1 <= p) and (p <= 9): self.stack[0][3][p - 1] = True elif (21 <= p) and (p <= 29): self.stack[0][3][p - 21] = False elif p == 39: self.stack[0][1] = None @@ -1313,7 +1366,8 @@ linuxvt = os.environ['TERM'] == 'linux' ''' Whether the script is executed as ponythink ''' -isthink = (len(__file__) >= 8) and (__file__[-8:] == 'think.py') +isthink = (len(__file__) >= 5) and (__file__[-5:] == 'think') +isthink = ((len(__file__) >= 8) and (__file__[-8:] == 'think.py')) or isthink ''' @@ -1354,15 +1408,26 @@ for quotedir in _quotedirs: quotedirs.append(quotedir) +''' +The directories where balloon style files are stored +''' +balloondirs = [] +_balloondirs = [HOME + '/.local/share/ponysay/balloons/', INSTALLDIR + '/share/ponysay/balloons/'] +for balloondir in _balloondirs: + if os.path.isdir(balloondir): + balloondirs.append(balloondir) + + usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' usage_wrap = '--wrap \033[4mCOLUMN\033[24m' -usage_listhelp = '(--list | ---altlist | --version | --help)' +usage_balloon = '--balloon \033[4mSTYLE\033[24m' +usage_listhelp = '(--list | --altlist | --balloonlist | --version | --help)' usage_file = '[--pony \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' usage_quote = '--quote [\033[4mPONY\033[24m...]' -usage = '%s %s\n%s [%s] %s\n%s [%s] %s' % (usage_saythink, usage_listhelp, - usage_saythink, usage_wrap, usage_file, - usage_saythink, usage_wrap, usage_quote) +usage = '%s %s\n%s [%s] [%s] %s\n%s [%s] [%s] %s' % (usage_saythink, usage_listhelp, + usage_saythink, usage_wrap, usage_balloon, usage_file, + usage_saythink, usage_wrap, usage_balloon, usage_quote) usage = usage.replace('\033[', '\0') for sym in ('[', ']', '(', ')', '|', '...'): @@ -1384,13 +1449,15 @@ run `man ponysay`. Ponysay has so much more to offer than described here.''') opts.add_argumentless(['--quoters']) opts.add_argumentless(['--onelist']) -opts.add_argumentless(['-h', '--help'], help = 'Print this help message.') -opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.') -opts.add_argumentless(['-l', '--list'], help = 'List pony files.') -opts.add_argumentless(['-L', '--altlist'], help = 'List pony files with alternatives.') -opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.') -opts.add_argumented( ['-f', '--pony'], arg = 'PONY', help = 'Select a pony.\nEither a file name or a pony name.') -opts.add_variadic( ['-q', '--quote'], arg = 'PONY', help = 'Select a ponies which will quote themself.') +opts.add_argumentless(['-h', '--help'], help = 'Print this help message.') +opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.') +opts.add_argumentless(['-l', '--list'], help = 'List pony names.') +opts.add_argumentless(['-L', '--altlist'], help = 'List pony names with alternatives.') +opts.add_argumentless(['-B', '--balloonlist'], help = 'list balloon styles.') +opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.') +opts.add_argumented( ['-b', '--bubble', '--balloon'], arg = 'STYLE', help = 'Select a balloon style.') +opts.add_argumented( ['-f', '--file', '--pony'], arg = 'PONY', help = 'Select a pony.\nEither a file name or a pony name.') +opts.add_variadic( ['-q', '--quote'], arg = 'PONY', help = 'Select a ponies which will quote themself.') opts.parse() -- cgit From 194ddff8fa50b493e822012c51c026de1f76ea2d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 17:51:39 +0200 Subject: manual updat --- manuals/ponysay.texinfo | 72 ++++++++++++++++++++++++++++++++++++++++++++++ manuals/ponysay_front.xcf | Bin 1007534 -> 998210 bytes ponysay.pdf | Bin 333828 -> 338298 bytes 3 files changed, 72 insertions(+) diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index d0a9cfb..766c73e 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -819,6 +819,7 @@ but is still available at @url{https://github.com/maandree/kmsponies4ponysay}. @menu * Pony anatomy:: Anatomy of pony files. * Pony quote infrastructure:: Pony quote infrastructure. +* Balloon style files:: Balloon style files. * Printing in TTY with KMS:: Printing in TTY with KMS. * Truncation:: Output truncation. * Languages:: Selection of languages. @@ -880,6 +881,77 @@ when compiled to @code{quotes}. The source quote files are indentical to the com quote files, except that there name contains just the first pony. +@node Balloon style files +@section Balloon style files +@cindex balloon style files +@cindex bubble style files +@cindex @command{ponythink} + +Balloon style files are located in the directory @code{balloons}, the ones ending with +@code{.say} applies to @command{ponysay} and the ones ending with @code{.think} applies +to @command{ponythink}. + +Balloon style consists of 20 strings. Each string is definied on separate lines, by their +name and their value seperated with a colon (@code{name:value}), if the name is empty it +continues the last one new line in the value. Only 10 of the strings may be multilined: +@code{nw}, @code{nnw}, @code{n}, @code{nne}, @code{ne}, @code{sw}, @code{ssw}, @code{s} +@code{sse} and @code{se}. + +The following strings are used, and must be definied in the files: +@table @option +@item \ +The character for the link to the balloon directed as @code{\}. +@item / +The character for the link to the balloon directed as @code{/}. +@item ww +The beginning of the balloon's line where the message is located if and only if the +message contains only one line. +@item ee +The end of the balloon's line where the message is located if and only if the message +contains only one line. +@item nw +The top left corner of the balloon. +@item nnw +If both this string and the @code{'nne'} string fits between the top corners, this +is printed directly to the right of the top left corner. +@item n +The top edge of the balloon. +@item nne +If both this string and the @code{'nnw'} string fits between the top corners, this +is printed directly to the right of the top top corner. +@item ne +The top right corner of the balloon. +@item nee +The end of the balloon's line where the message's first line is located if and only +if the message contains more than one line. +@item e +The right edge of the balloon. +@item see +The end of the balloon's line where the message's last line is located if and only +if the message contains more than one line. +@item se +The bottom right corner of the balloon. +@item sse +If both this string and the @code{'ssw'} string fits between the bottom corners, this +is printed directly to the left of the bottom right corner. +@item s +The bottom edge of the balloon. +@item ssw +If both this string and the @code{'sse'} string fits between the bottom corners, this +is printed directly to the right of the bottom left corner. +@item sw +The bottom left corner of the balloon. +@item sww +The beginning of the balloon's line where the message's last line is located if and +only if the message contains more than one line. +@item w +The left edge of the balloon. +@item nww +The beginning of the balloon's line where the message's first line is located if and +only if the message contains more than one line. +@end table + + @node Printing in TTY with KMS @section Printing in TTY with KMS @cindex tty diff --git a/manuals/ponysay_front.xcf b/manuals/ponysay_front.xcf index 9ba8d0d..c785502 100644 Binary files a/manuals/ponysay_front.xcf and b/manuals/ponysay_front.xcf differ diff --git a/ponysay.pdf b/ponysay.pdf index d96a57f..701e535 100644 Binary files a/ponysay.pdf and b/ponysay.pdf differ -- cgit From c13ce26768e760908078244e251c7b3c19b26a8f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 19:35:55 +0200 Subject: automatic cache clean --- configure | 1 - ponysay | 26 +++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 6cde35b..6e1c963 100755 --- a/configure +++ b/configure @@ -239,7 +239,6 @@ function makeMakefile() echo echo 'install-cache:' - echo -en '\t' ; echo 'if [ -d "/var/cache/ponysay" ]; then rm -r "/var/cache/ponysay"; fi' echo -en '\t' ; echo 'mkdir -p "$(DESTDIR)/var/cache/ponysay/"' echo -en '\t' ; echo 'chmod 777 "$(DESTDIR)/var/cache/ponysay/"' echo diff --git a/ponysay b/ponysay index fedaab6..7eb6dd5 100755 --- a/ponysay +++ b/ponysay @@ -24,7 +24,7 @@ from subprocess import Popen, PIPE ''' The version of ponysay ''' -VERSION = '2.2' +VERSION = '2.3' ''' @@ -533,6 +533,8 @@ class Ponysay(): if not linuxvt: return pony + KMS_VERSION = '1' + env_kms = os.environ['PONYSAY_KMS_PALETTE'] if 'PONYSAY_KMS_PALETTE' in os.environ else None if env_kms is None: env_kms = '' @@ -554,6 +556,28 @@ class Ponysay(): if not os.path.isdir(cachedir): os.makedirs(cachedir) + newversion = False + if not os.path.isfile(cachedir + '/.version'): + newversion = True + else: + cachev = None + try: + cachev = open(cachedir + '/.version', 'r') + if ''.join(cachev.readlines()) == KMS_VERSION: + newversion = True + finally: + if cachev is not None: + cachev.close() + if newversion: + for cached in os.listdir(ponydir): + shutil.rmtree(cachedir + '/' + cached, False) + try: + cachev = open(cachedir + '/.version', 'w+') + cachev.write(KMS_VERSION) + finally: + if cachev is not None: + cachev.close() + kmsponies = cachedir + '/kmsponies/' + palettefile kmspony = (kmsponies + pony).replace('//', '/') -- cgit From 49e7ad42ebc79462d6827c8a5316adeeade43fcb Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 19:37:51 +0200 Subject: forgot import --- ponysay | 1 + 1 file changed, 1 insertion(+) diff --git a/ponysay b/ponysay index 7eb6dd5..175fa63 100755 --- a/ponysay +++ b/ponysay @@ -16,6 +16,7 @@ License: WTFPL ''' import os +import shutil import sys import random from subprocess import Popen, PIPE -- cgit From 8ac0aceadcadb4241d04ab65897a47b9e817d4b4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 19:45:35 +0200 Subject: derp --- ponysay | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ponysay b/ponysay index 175fa63..82f16b9 100755 --- a/ponysay +++ b/ponysay @@ -570,8 +570,13 @@ class Ponysay(): if cachev is not None: cachev.close() if newversion: - for cached in os.listdir(ponydir): - shutil.rmtree(cachedir + '/' + cached, False) + for cached in os.listdir(cachedir): + cached = cachedir + '/' + cached + if os.path.isdir(cached) and not os.path.islink(cached): + shutil.rmtree(cached, False) + else: + os.remove(cached) + cachev = None try: cachev = open(cachedir + '/.version', 'w+') cachev.write(KMS_VERSION) -- cgit From b6dfc3bd2ed4e69beaafb750c868c4200ac84223 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 19:48:24 +0200 Subject: typo in code make e.g fillycadance draw incorrectly --- ponysay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ponysay b/ponysay index 82f16b9..96ce9e6 100755 --- a/ponysay +++ b/ponysay @@ -1356,7 +1356,7 @@ class ColourStack(): elif (1 <= p) and (p <= 9): self.stack[0][3][p - 1] = True elif (21 <= p) and (p <= 29): self.stack[0][3][p - 21] = False elif p == 39: self.stack[0][1] = None - elif p == 40: self.stack[0][2] = None + elif p == 49: self.stack[0][2] = None elif (30 <= p) and (p <= 37): self.stack[0][1] = part elif (90 <= p) and (p <= 97): self.stack[0][1] = part elif (40 <= p) and (p <= 47): self.stack[0][2] = part -- cgit From 2eb9342b864725d301a3dbc25423da6fcb174c13 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 21:29:24 +0200 Subject: support for best.pony --- ponysay | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/ponysay b/ponysay index 96ce9e6..a550578 100755 --- a/ponysay +++ b/ponysay @@ -47,6 +47,7 @@ class Ponysay(): args.help() return + if args.opts['-h'] is not None: args.help() elif args.opts['--quoters'] is not None: self.quoters() elif args.opts['--onelist'] is not None: self.onelist() @@ -54,8 +55,17 @@ class Ponysay(): elif args.opts['-l'] is not None: self.list() elif args.opts['-L'] is not None: self.linklist() elif args.opts['-B'] is not None: self.balloonlist() - elif args.opts['-q'] is not None: self.quote(args) - else: self.print_pony(args) + else: + if (args.opts['-f'] is None) or (args.opts['-q'] is None) or (len(args.opts['-q']) == 0): + for ponydir in ponydirs: + if os.path.isfile(ponydir + 'best.pony') or os.path.islink(ponydir + 'best.pony'): + pony = os.path.realpath(ponydir + 'best.pony') # Canonical path + if args.opts['-q'] is not None: args.opts['-q'] = [pony] + else: args.opts['-f'] = [pony] + break + + if args.opts['-q'] is not None: self.quote(args) + else: self.print_pony(args) ## @@ -480,11 +490,19 @@ class Ponysay(): def quote(self, args): pairs = self.__quotes() if len(args.opts['-q']) > 0: - ponyset = set(args.opts['-q']) + ponyset = {} + for pony in args.opts['-q']: + if (len(pony) > 5) and (pony[-5:] == '.pony'): + ponyname = pony[:-5] + if '/' in ponyname: + ponyname = ponyname[ponyname.rindex('/') + 1:] + ponyset[ponyname] = pony + else: + ponyset[pony] = pony alts = [] for pair in pairs: if pair[0] in ponyset: - alts.append(pair) + alts.append((ponyset[pair[0]], pair[1])) pairs = alts if not len(pairs) == 0: @@ -498,11 +516,11 @@ class Ponysay(): qfile.close() args.opts['-f'] = [pair[0]] elif len(args.opts['-q']) == 0: - sys.stderr.write('All the ponies are mute! Call the Princess!\n') + sys.stderr.write('Princess Celestia! All the ponies are mute!\n') exit(1) else: args.opts['-f'] = [args.opts['-q'][random.randrange(0, len(args.opts['-q']))]] - args.message = 'I got nuthin\' good to say :(' + args.message = 'Zecora! Help me, I am mute!' self.print_pony(args) -- cgit From 8cc7a919b4cdd8b4a9c0873dfb0cb8f6ff3dac59 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 21:41:08 +0200 Subject: misc --- CHANGELOG | 9 ++++++++- completion/fish-completion.fish | 18 +++++++++--------- manuals/ponysay.texinfo | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cc46a68..9c56e93 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +Version 2.3 + + Support for 'best.pony' file. + + `-q` accepts file names. + + Version 2.2 Full support for arbitrary positioning of balloon in pony files. @@ -8,7 +15,7 @@ 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` + available. This list depends on whether you are invoking `ponysay` or `ponythink`. Version 2.1.1 diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish index ead664b..c211982 100644 --- a/completion/fish-completion.fish +++ b/completion/fish-completion.fish @@ -8,15 +8,15 @@ set -g quoters ('/usr/bin/ponysay' --quoters) set -g balloons ('/usr/bin/ponysay' --balloonlist) -complete --command ponysay --short-option h --long-option help --description 'help of ponysay' -complete --command ponysay --short-option v --long-option version --description 'version of ponysay' -complete --command ponysay --short-option l --long-option list --description 'list pony names' -complete --command ponysay --short-option L --long-option altlist --description 'list pony names with alternatives' -complete --command ponysay --short-option B --long-option balloonlist --description 'list balloon style names' -complete --command ponysay --short-option f --long-option pony --arguments "$ponies" --description 'pony' -complete --command ponysay --short-option q --long-option quote --arguments "$quoters" --no-files --description 'pony' -complete --command ponysay --short-option b --long-option balloon --arguments "$balloons" --description 'balloon style' -complete --command ponysay --short-option W --long-option wrap --arguments 'Integer' --description 'specify the column when the message should be wrapped' +complete --command ponysay --short-option h --long-option help --description 'help of ponysay' +complete --command ponysay --short-option v --long-option version --description 'version of ponysay' +complete --command ponysay --short-option l --long-option list --description 'list pony names' +complete --command ponysay --short-option L --long-option altlist --description 'list pony names with alternatives' +complete --command ponysay --short-option B --long-option balloonlist --description 'list balloon style names' +complete --command ponysay --short-option f --long-option pony --arguments "$ponies" --description 'pony' +complete --command ponysay --short-option q --long-option quote --arguments "$quoters" --description 'pony' +complete --command ponysay --short-option b --long-option balloon --arguments "$balloons" --description 'balloon style' +complete --command ponysay --short-option W --long-option wrap --arguments 'Integer' --description 'specify the column when the message should be wrapped' complete --command ponysay --arguments 'MESSAGE' set -e ponies diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 766c73e..137ec79 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -172,6 +172,8 @@ is added as an argument after @command{-q}. If one or more ponies are added afte This option requires the extension @command{ponyquotes4ponysay}, which is included by default since version 1.2. +The argument can be a file name, but pony if it ends with @code{.pony}. + @item -W COLUMN @itemx --wrap COLUMN @cindex @command{-W} @@ -206,12 +208,17 @@ target ponies. Prints a list of all balloon styles. @end table +@cindex @var{message} If neither @command{-q} is used nor any @var{message} is specified, @command{ponysay} will read the message from stdin (standard input); however, if no arguments are used that nothing is piped to stdin, a help message will be printed. If you want to use @command{ponysay} without arguments and enter the message by hand, you can run @code{cat | ponysay}. +@cindex @code{best.pony} +If no pony is selected, @command{ponysay} will look for a @code{best.pony} file, +this should be a symbolic link to the pony you want as a default. If it is not +a symbolic link, @command{-q} cannot determine which quotes to use. @node Advanced usage @@ -1124,6 +1131,15 @@ first pony file in common. @cindex versions @cindex previous releases +@heading Version 2.3 + +@itemize @bullet +@item +Support for @code{best.pony} file. +@item +@code{-q} accepts file names. +@end itemize + @heading Version 2.2 @itemize @bullet -- cgit From adbf4659be82b3d08352009e7e74726edc1b81a0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Aug 2012 22:57:27 +0200 Subject: UCS renaming map, place in share/ a directory for misc resource files that do not need a directory --- manuals/ponysay.texinfo | 4 ++-- ponysay.pdf | Bin 338298 -> 346972 bytes share/ucsmap | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 share/ucsmap diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 137ec79..f5ca6af 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -8,7 +8,7 @@ @documentlanguage en @finalout @c %**end of header -@set VERSION 2.2 +@set VERSION 2.3 @copying This manual is for ponysay @@ -892,7 +892,7 @@ quote files, except that there name contains just the first pony. @section Balloon style files @cindex balloon style files @cindex bubble style files -@cindex @command{ponythink} +@cindex ponythink Balloon style files are located in the directory @code{balloons}, the ones ending with @code{.say} applies to @command{ponysay} and the ones ending with @code{.think} applies diff --git a/ponysay.pdf b/ponysay.pdf index 701e535..d34e77b 100644 Binary files a/ponysay.pdf and b/ponysay.pdf differ diff --git a/share/ucsmap b/share/ucsmap new file mode 100644 index 0000000..14f8252 --- /dev/null +++ b/share/ucsmap @@ -0,0 +1,5 @@ +mjölna → mjolna +piñacolada → pinacolada +vın̈yl → vinyl + +#jesús pezuña -- cgit From f76bef8facffab5eda3b9faefe76591f8d1a163a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 00:09:07 +0200 Subject: accepts ucs in -f and -q --- configure | 5 +++- ponysay | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 74 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 6e1c963..6f8b57d 100755 --- a/configure +++ b/configure @@ -17,7 +17,7 @@ oldInstalledDirs='lib/ponysay share/ponies share/ttyponies bin/ponysaylist.pl' oldCompiledFiles='truncater ponysaytruncater ponysay.py.install' oldCompiledDirs='' -installedFiles='bin/ponysay bin/ponythink doc/ponysay.pdf share/info/ponysay.info.gz share/info/ponythink.info.gz' +installedFiles='bin/ponysay bin/ponythink doc/ponysay.pdf share/info/ponysay.info.gz share/info/ponythink.info.gz share/ponysay/ucsmap' installedDirs='share/ponysay lib/ponysay' compiledFiles='ponysay.info ponysay.info.gz ponysay.install ponysay.install~' compiledDirs='quotes' @@ -231,6 +231,9 @@ function makeMakefile() echo -en '\t' ; echo 'install "ponysay.install" "$(INSTALLDIR)/bin/ponysay"' echo -en '\t' ; echo 'ln -sf "ponysay" "$(INSTALLDIR)/bin/ponythink"' echo + echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/"' + echo -en '\t' ; echo 'install "share/ucsmap" "$(INSTALLDIR)/share/ponysay/ucsmap"' + echo echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/licenses/ponysay/"' for file in $licenseFiles; do echo -en '\t' diff --git a/ponysay b/ponysay index a550578..afcc595 100755 --- a/ponysay +++ b/ponysay @@ -56,14 +56,8 @@ class Ponysay(): elif args.opts['-L'] is not None: self.linklist() elif args.opts['-B'] is not None: self.balloonlist() else: - if (args.opts['-f'] is None) or (args.opts['-q'] is None) or (len(args.opts['-q']) == 0): - for ponydir in ponydirs: - if os.path.isfile(ponydir + 'best.pony') or os.path.islink(ponydir + 'best.pony'): - pony = os.path.realpath(ponydir + 'best.pony') # Canonical path - if args.opts['-q'] is not None: args.opts['-q'] = [pony] - else: args.opts['-f'] = [pony] - break - + self.__bestpony(args) + self.__ucsremap(args) if args.opts['-q'] is not None: self.quote(args) else: self.print_pony(args) @@ -72,6 +66,58 @@ class Ponysay(): ## Auxiliary methods ## + ''' + Use best.pony if nothing else is set + ''' + def __bestpony(self, args): + if (args.opts['-f'] is None) or (args.opts['-q'] is None) or (len(args.opts['-q']) == 0): + for ponydir in ponydirs: + if os.path.isfile(ponydir + 'best.pony') or os.path.islink(ponydir + 'best.pony'): + pony = os.path.realpath(ponydir + 'best.pony') # Canonical path + if args.opts['-q'] is not None: args.opts['-q'] = [pony] + else: args.opts['-f'] = [pony] + break + + + ''' + Apply pony name remapping to args according to UCS settings + ''' + def __ucsremap(self, args): + env_ucs = os.environ['PONYSAY_UCS_ME'] if 'PONYSAY_UCS_ME' in os.environ else '' + ucs_conf = 0 + if env_ucs in ('yes', 'y', '1'): ucs_conf = 1 + elif env_ucs in ('harder', 'h', '2'): ucs_conf = 2 + + if ucs_conf == 0: + return + + maplines = [] + for sharedir in sharedirs: + if os.path.isfile(sharedir + 'ucsmap'): + mapfile = None + try: + mapfile = open(sharedir + 'ucsmap', 'r') + maplines += [line.replace('\n', '') for line in mapfile.readlines()] + finally: + if mapfile is not None: + mapfile.close() + + map = {} + stripset = ' \t' # must be string, wtf! and way doesn't python's doc say so + for line in maplines: + if (len(line) > 0) and not (line[0] == '#'): + s = line.index('→') + ucs = line[:s] .strip(stripset) + ascii = line[s + 1:].strip(stripset) + map[ucs] = ascii + + for flag in ('-f', '-q'): + if args.opts[flag] is not None: + for i in range(0, len(args.opts[flag])): + if args.opts[flag][i] in map: + args.opts[flag][i] = map[args.opts[flag][i]] + + ''' Returns one file with full path, names is filter for names, also accepts filepaths ''' @@ -1402,13 +1448,13 @@ class ColourStack(): ''' The user's home directory ''' -HOME = os.environ['HOME'] +HOME = os.environ['HOME'] if 'HOME' in os.environ else os.path.expanduser('~') ''' Whether the program is execute in Linux VT (TTY) ''' -linuxvt = os.environ['TERM'] == 'linux' +linuxvt = ('TERM' in os.environ) and (os.environ['TERM'] == 'linux') ''' @@ -1434,13 +1480,23 @@ Whether stderr is piped pipelineerr = not sys.stderr.isatty() +''' +Root share/ directories +''' +sharedirs = [] +_sharedirs = [HOME + '/.local/share/ponysay/', INSTALLDIR + '/share/ponysay/'] +for sharedir in _sharedirs: + if os.path.isdir(sharedir): + sharedirs.append(sharedir) + + ''' The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY) ''' ponydirs = [] _kms = Ponysay.isUsingKMS() -if linuxvt and not _kms: _ponydirs = [HOME + '/.local/share/ponysay/ttyponies/', INSTALLDIR + '/share/ponysay/ttyponies/'] -else: _ponydirs = [HOME + '/.local/share/ponysay/ponies/', INSTALLDIR + '/share/ponysay/ponies/' ] +if linuxvt and not _kms: _ponydirs = [d + 'ttyponies/' for d in sharedirs] +else: _ponydirs = [d + 'ponies/' for d in sharedirs] for ponydir in _ponydirs: if os.path.isdir(ponydir): ponydirs.append(ponydir) @@ -1450,7 +1506,7 @@ for ponydir in _ponydirs: The directories where quotes files are stored ''' quotedirs = [] -_quotedirs = [HOME + '/.local/share/ponysay/quotes/', INSTALLDIR + '/share/ponysay/quotes/'] +_quotedirs = [d + 'quotes/' for d in sharedirs] for quotedir in _quotedirs: if os.path.isdir(quotedir): quotedirs.append(quotedir) @@ -1460,7 +1516,7 @@ for quotedir in _quotedirs: The directories where balloon style files are stored ''' balloondirs = [] -_balloondirs = [HOME + '/.local/share/ponysay/balloons/', INSTALLDIR + '/share/ponysay/balloons/'] +_balloondirs = [d + 'balloons/' for d in sharedirs] for balloondir in _balloondirs: if os.path.isdir(balloondir): balloondirs.append(balloondir) -- cgit From 5744c13146e3401e479e58cca87d872423b046e2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 00:11:10 +0200 Subject: I think readlink only follows one level, this should get the canonical path (absolute and to the last level) --- ponysay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ponysay b/ponysay index afcc595..f177ad3 100755 --- a/ponysay +++ b/ponysay @@ -257,7 +257,7 @@ class Ponysay(): if (len(pony) > 5) and (pony[-5:] == '.pony'): ponies.append(pony[:-5]) ponies.sort() - pairs = [(pony, os.readlink(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else '') for pony in ponies] + pairs = [(pony, os.path.realpath(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else '') for pony in ponies] ponymap = {} for pair in pairs: -- cgit From 2227c0c5b780343e501a82cc0faff900bedd8e8f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 00:48:18 +0200 Subject: some work needed on UCS, otherwise complete --- ponysay | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/ponysay b/ponysay index f177ad3..88ab9aa 100755 --- a/ponysay +++ b/ponysay @@ -118,6 +118,49 @@ class Ponysay(): args.opts[flag][i] = map[args.opts[flag][i]] + ''' + Apply USC:ise pony names according to UCS settings + ''' + def __ucsise(self, ponies, links = None): + env_ucs = os.environ['PONYSAY_UCS_ME'] if 'PONYSAY_UCS_ME' in os.environ else '' + ucs_conf = 0 + if env_ucs in ('yes', 'y', '1'): ucs_conf = 1 + elif env_ucs in ('harder', 'h', '2'): ucs_conf = 2 + + if ucs_conf == 0: + return + + maplines = [] + for sharedir in sharedirs: + if os.path.isfile(sharedir + 'ucsmap'): + mapfile = None + try: + mapfile = open(sharedir + 'ucsmap', 'r') + maplines += [line.replace('\n', '') for line in mapfile.readlines()] + finally: + if mapfile is not None: + mapfile.close() + + map = {} + stripset = ' \t' # must be string, wtf! and way doesn't python's doc say so + for line in maplines: + if (len(line) > 0) and not (line[0] == '#'): + s = line.index('→') + ucs = line[:s] .strip(stripset) + ascii = line[s + 1:].strip(stripset) + map[ascii] = ucs + + if ucs_conf == 1: + for pony in ponies: + if pony in map: + ponies.append(map[pony]) + else: + for j in range(0, len(ponies)): + if ponies[j] in map: + ponies[j] = map[ponies[j]] + + + ''' Returns one file with full path, names is filter for names, also accepts filepaths ''' @@ -225,6 +268,7 @@ class Ponysay(): for pony in _ponies: if (len(pony) > 5) and (pony[-5:] == '.pony'): ponies.append(pony[:-5]) + self.__ucsise(ponies) ponies.sort() width = len(max(ponies, key = len)) + 2 # Get the longest ponyfilename lenght + 2 spaces @@ -256,6 +300,8 @@ class Ponysay(): for pony in _ponies: if (len(pony) > 5) and (pony[-5:] == '.pony'): ponies.append(pony[:-5]) + pseudolinkmap = [] + self.__ucsise(ponies, pseudolinkmap) ##TODO ponies.sort() pairs = [(pony, os.path.realpath(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else '') for pony in ponies] @@ -320,6 +366,7 @@ class Ponysay(): ponies = [] for pony in self.__quoters(): ponies.append(pony) + self.__ucsise(ponies) ponies.sort() for pony in ponies: if not pony == last: @@ -339,6 +386,7 @@ class Ponysay(): for pony in _ponies: if (len(pony) > 5) and (pony[-5:] == '.pony'): ponies.append(pony[:-5]) + self.__ucsise(ponies) ponies.sort() for pony in ponies: if not pony == last: -- cgit From 08fb7cc7e66f4cc5917b4b15a61b111abe94cc27 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 01:34:06 +0200 Subject: support for combining characters (now we have full unicode support) --- ponysay | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/ponysay b/ponysay index 88ab9aa..a727aab 100755 --- a/ponysay +++ b/ponysay @@ -271,11 +271,11 @@ class Ponysay(): self.__ucsise(ponies) ponies.sort() - width = len(max(ponies, key = len)) + 2 # Get the longest ponyfilename lenght + 2 spaces + width = UCS.dispLen(max(ponies, key = UCS.dispLen)) + 2 # Get the longest ponyfilename lenght + 2 spaces x = 0 for pony in ponies: - spacing = ' ' * (width - len(pony)) + spacing = ' ' * (width - UCS.dispLen(pony)) print(('\033[1m' + pony + '\033[21m' if (pony in quoters) else pony) + spacing, end='') # Print ponyfilename x += width if x > (termsize[1] - width): # If too wide, make new line @@ -323,7 +323,7 @@ class Ponysay(): ponies = [] widths = [] for pony in ponymap: - w = len(pony) + w = UCS.dispLen(pony) item = '\033[1m' + pony + '\033[21m' if (pony in quoters) else pony syms = ponymap[pony] if len(syms) > 0: @@ -331,7 +331,7 @@ class Ponysay(): item += ' (' first = True for sym in syms: - w += len(sym) + w += UCS.dispLen(sym) if not first: item += ' ' else: @@ -420,11 +420,11 @@ class Ponysay(): balloons = list(balloonset) balloons.sort() - width = len(max(balloons, key = len)) + 2 + width = UCS.dispLen(max(balloons, key = UCS.dispLen)) + 2 x = 0 for balloon in balloons: - spacing = ' ' * (width - len(balloon)) + spacing = ' ' * (width - UCS.dispLen(balloon)) print(balloon + spacing, end='') x += width if x > (termsize[1] - width): @@ -961,13 +961,13 @@ class Balloon(): (self.sse, self.s, self.ssw) = (sse, s, ssw) (self.sww, self.w, self.nww) = (sww, w, nww) - _ne = max(ne, key = len) - _nw = max(nw, key = len) - _se = max(se, key = len) - _sw = max(sw, key = len) + _ne = max(ne, key = UCS.dispLen) + _nw = max(nw, key = UCS.dispLen) + _se = max(se, key = UCS.dispLen) + _sw = max(sw, key = UCS.dispLen) - minE = len(max([_ne, nee, e, see, _se, ee], key = len)) - minW = len(max([_nw, nww, e, sww, _sw, ww], key = len)) + minE = UCS.dispLen(max([_ne, nee, e, see, _se, ee], key = UCS.dispLen)) + minW = UCS.dispLen(max([_nw, nww, e, sww, _sw, ww], key = UCS.dispLen)) minN = len(max([ne, nne, n, nnw, nw], key = len)) minS = len(max([se, sse, s, ssw, sw], key = len)) @@ -1282,7 +1282,8 @@ class Backend(): i += len(self.__getcolour(input, i)) else: i += 1 - rc += 1 + if not UCS.isCombining(c): + rc += 1 return rc @@ -1355,7 +1356,8 @@ class Backend(): indentc += 1 b[bi] = d bi += 1 - cols += 1 + if not UCS.isCombining(d): + cols += 1 map[cols] = bi else: mm = 0 @@ -1492,6 +1494,43 @@ class ColourStack(): +''' +UCS utility class +''' +class UCS(): + ''' + Checks whether a character is a combining character + ''' + @staticmethod + def isCombining(char): + o = ord(char) + if (0x0300 <= o) and (o <= 0x036F): return True + if (0x20D0 <= o) and (o <= 0x20FF): return True + if (0x1DC0 <= o) and (o <= 0x1DFF): return True + if (0xFE20 <= o) and (o <= 0xFE2F): return True + return False + + + ''' + Gets the number of combining characters in a string + ''' + @staticmethod + def countCombining(string): + rc = 0 + for char in string: + if UCS.isCombining(char): + rc += 1 + return rc + + + ''' + Gets length of a string not counting combining characters + ''' + @staticmethod + def dispLen(string): + return len(string) - UCS.countCombining(string) + + ''' The user's home directory -- cgit From 22d7318624f834254ecdb0c6bdf9536dee3cae37 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 01:55:50 +0200 Subject: warping error with combining characters --- ponysay | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ponysay b/ponysay index a727aab..6086352 100755 --- a/ponysay +++ b/ponysay @@ -995,19 +995,19 @@ class Balloon(): rc = [] for j in range(0, len(self.n)): - outer = len(self.nw[j]) + len(self.ne[j]) - inner = len(self.nnw[j]) + len(self.nne[j]) + outer = UCS.dispLen(self.nw[j]) + UCS.dispLen(self.ne[j]) + inner = UCS.dispLen(self.nnw[j]) + UCS.dispLen(self.nne[j]) if outer + inner >= w: rc.append(self.nw[j] + self.nnw[j] + self.n[j] * (w - outer - inner) + self.nne[j] + self.ne[j]) else: rc.append(self.nw[j] + self.n[j] * (w - outer) + self.ne[j]) for j in range(0, len(lines)): - rc.append(ws[j] + lines[j] + ' ' * (w - lencalc(lines[j]) - len(self.w) - len(self.e)) + es[j]) + rc.append(ws[j] + lines[j] + ' ' * (w - lencalc(lines[j]) - UCS.dispLen(self.w) - UCS.dispLen(self.e)) + es[j]) for j in range(0, len(self.s)): - outer = len(self.sw[j]) + len(self.se[j]) - inner = len(self.ssw[j]) + len(self.sse[j]) + outer = UCS.dispLen(self.sw[j]) + UCS.dispLen(self.se[j]) + inner = UCS.dispLen(self.ssw[j]) + UCS.dispLen(self.sse[j]) if outer + inner >= w: rc.append(self.sw[j] + self.ssw[j] + self.s[j] * (w - outer - inner) + self.sse[j] + self.se[j]) else: @@ -1069,7 +1069,8 @@ class Backend(): x += nx else: buf += c - x += 1 + if not UCS.isCombining(c): + x += 1 buf += '\n' self.message = buf[:-1] @@ -1107,7 +1108,8 @@ class Backend(): else: if x < self.width: self.output += c - x += 1 + if not UCS.isCombining(c): + x += 1 self.output += '\n' self.output = self.output[:-1] @@ -1222,7 +1224,8 @@ class Backend(): if nonskip > 0: nonskip -= 1 self.output += c + colourstack.feed(c); - indent += 1 + if not UCS.isCombining(c): + indent += 1 else: skip -= 1 @@ -1302,7 +1305,7 @@ class Backend(): msg = self.__wrapMessage(msg, wrap) lines = msg.split('\n') - return self.balloon.get(width, height, lines, self.__len) + return self.balloon.get(width, height, lines, lambda text : self.__len(text) - UCS.countCombining(text)) ''' -- cgit From beeed62f49f98fc2b29b8f057fd3499a22cad22b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 01:59:06 +0200 Subject: support pipes and sockets as ponyfiles and balloon files --- ponysay | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ponysay b/ponysay index 6086352..50e19b2 100755 --- a/ponysay +++ b/ponysay @@ -175,7 +175,7 @@ class Ponysay(): if not names == None: for name in names: - if os.path.isfile(name): + if os.path.exists(name): ponies[name] = name if names == None: @@ -455,7 +455,7 @@ class Ponysay(): balloons[balloon] = balloondir + balloonfile for name in names: - if os.path.isfile(name): + if os.path.exists(name): balloons[name] = name if names == None: -- cgit From a9c0dedfbc908be9bef30101737f9e0a1a5112d1 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 02:50:35 +0200 Subject: wrap correction --- CHANGELOG | 7 +++++++ manuals/ponysay.texinfo | 7 +++++++ ponysay | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 9c56e93..da945ae 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,13 @@ Version 2.3 `-q` accepts file names. + Improved Unicode support: treats combining characters as invisible + + Optional support for UCS pony names + + Pony files and balloon style files can be pipes (as + well as sockets, doors and as always regular files.) + Version 2.2 diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index f5ca6af..77947aa 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -1138,6 +1138,13 @@ first pony file in common. Support for @code{best.pony} file. @item @code{-q} accepts file names. +@item +Improved Unicode support: treats combining characters as invisible +@item +Optional support for UCS pony names +@item +Pony files and balloon style files can be pipes (as well as sockets, doors +and as always regular files) @end itemize @heading Version 2.2 diff --git a/ponysay b/ponysay index 50e19b2..1a69e01 100755 --- a/ponysay +++ b/ponysay @@ -1305,7 +1305,7 @@ class Backend(): msg = self.__wrapMessage(msg, wrap) lines = msg.split('\n') - return self.balloon.get(width, height, lines, lambda text : self.__len(text) - UCS.countCombining(text)) + return self.balloon.get(width, height, lines, self.__len) ''' -- cgit From 860919ddd4f367c9be70b6e746b02695dfa3767a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 03:23:11 +0200 Subject: sorting -L --- ponysay | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/ponysay b/ponysay index 1a69e01..8426fc4 100755 --- a/ponysay +++ b/ponysay @@ -154,6 +154,8 @@ class Ponysay(): for pony in ponies: if pony in map: ponies.append(map[pony]) + if links is not None: + links[map[pony]] = pony + '.pony' else: for j in range(0, len(ponies)): if ponies[j] in map: @@ -282,7 +284,7 @@ class Ponysay(): print() x = 0 - print('\n'); + print('' if x == 0 else '\n'); ''' @@ -300,14 +302,13 @@ class Ponysay(): for pony in _ponies: if (len(pony) > 5) and (pony[-5:] == '.pony'): ponies.append(pony[:-5]) - pseudolinkmap = [] + pseudolinkmap = {} self.__ucsise(ponies, pseudolinkmap) ##TODO - ponies.sort() - pairs = [(pony, os.path.realpath(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else '') for pony in ponies] + pairs = [(pony, os.path.realpath(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else None) for pony in ponies] ponymap = {} for pair in pairs: - if pair[1] == '': + if (pair[1] is None) or (pair[1] == ''): if pair[0] not in ponymap: ponymap[pair[0]] = [] else: @@ -320,8 +321,7 @@ class Ponysay(): ponymap[target] = [pair[0]] width = 0 - ponies = [] - widths = [] + ponies = {} for pony in ponymap: w = UCS.dispLen(pony) item = '\033[1m' + pony + '\033[21m' if (pony in quoters) else pony @@ -338,24 +338,25 @@ class Ponysay(): first = False item += '\033[1m' + sym + '\033[21m' if (sym in quoters) else sym item += ')' - ponies.append(item) - widths.append(w) + ponies[item] = w if width < w: width = w width += 2; x = 0 index = 0 - for pony in ponies: - spacing = ' ' * (width - widths[index]) + ponylist = list(ponies) + ponylist.sort(key = lambda pony : pony.split(' ')[0].replace('\033[1m', '').replace('\033[21m', '')) + for pony in ponylist: + spacing = ' ' * (width - ponies[pony]) index += 1 print(pony + spacing, end='') # Print pony file name x += width - if x > (termsize[1] - width): # If too wide, make new line + if x > termsize[1] - width: # If too wide, make new line print() x = 0 - print('\n'); + print('' if x == 0 else '\n'); ''' -- cgit From d179b3c18007d5e7c7326d3d2ae3b5f43cd88a70 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 03:28:21 +0200 Subject: sorting the symlinks in -L --- ponysay | 1 + 1 file changed, 1 insertion(+) diff --git a/ponysay b/ponysay index 8426fc4..b1911ce 100755 --- a/ponysay +++ b/ponysay @@ -326,6 +326,7 @@ class Ponysay(): w = UCS.dispLen(pony) item = '\033[1m' + pony + '\033[21m' if (pony in quoters) else pony syms = ponymap[pony] + syms.sort() if len(syms) > 0: w += 2 + len(syms) item += ' (' -- cgit From 44a3fbca3b9ed1a2504a3f297682e74891bea1ba Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 03:48:25 +0200 Subject: ucs name support complete --- ponysay | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ponysay b/ponysay index b1911ce..c120ca3 100755 --- a/ponysay +++ b/ponysay @@ -155,14 +155,13 @@ class Ponysay(): if pony in map: ponies.append(map[pony]) if links is not None: - links[map[pony]] = pony + '.pony' + links[map[pony]] = pony else: for j in range(0, len(ponies)): if ponies[j] in map: ponies[j] = map[ponies[j]] - ''' Returns one file with full path, names is filter for names, also accepts filepaths ''' @@ -251,6 +250,7 @@ class Ponysay(): return termsize + ## ## Listing methods ## @@ -304,7 +304,12 @@ class Ponysay(): ponies.append(pony[:-5]) pseudolinkmap = {} self.__ucsise(ponies, pseudolinkmap) ##TODO - pairs = [(pony, os.path.realpath(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else None) for pony in ponies] + pairs = [] + for pony in ponies: + if pony in pseudolinkmap: + pairs.append((pony, pseudolinkmap[pony] + '.pony')); + else: + pairs.append((pony, os.path.realpath(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else None)) ponymap = {} for pair in pairs: -- cgit From 9c6aeee703b821c78dd7ea6dd96359cc3a90c669 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 04:35:07 +0200 Subject: message stuff --- ponysay | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ponysay b/ponysay index c120ca3..6b33005 100755 --- a/ponysay +++ b/ponysay @@ -533,6 +533,25 @@ class Ponysay(): else: msg = args.message + if args.opts['-c'] is not None: ## This algorithm should give some result as cowsay's (according to tests) + buf = '' + last = ' ' + CHARS = '\t \n' + for c in msg: + if (c in CHARS) and (last in CHARS): + if last == '\n': + buf += last + last = c + else: + buf += c + last = c + msg = buf.strip(CHARS) + buf = '' + for c in msg: + if (c != '\n') or (last != '\n'): + buf += c + last = c + msg = buf.replace('\n', '\n\n') pony = self.__getponypath(args.opts['-f']) @@ -1412,7 +1431,7 @@ class Backend(): w -= indentc buf += '\n' - return buf[:-1] + return '\n'.join(line.rstrip() for line in buf[:-1].split('\n')) ''' @@ -1654,7 +1673,8 @@ opts.add_argumentless(['-h', '--help'], help = opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.') opts.add_argumentless(['-l', '--list'], help = 'List pony names.') opts.add_argumentless(['-L', '--altlist'], help = 'List pony names with alternatives.') -opts.add_argumentless(['-B', '--balloonlist'], help = 'list balloon styles.') +opts.add_argumentless(['-B', '--balloonlist'], help = 'List balloon styles.') +opts.add_argumentless(['-c', '--compact'], help = 'Compress messages.') opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.') opts.add_argumented( ['-b', '--bubble', '--balloon'], arg = 'STYLE', help = 'Select a balloon style.') opts.add_argumented( ['-f', '--file', '--pony'], arg = 'PONY', help = 'Select a pony.\nEither a file name or a pony name.') -- cgit From c028dd9537729c12c64fd7e8a8c8c472eb4b431d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 04:46:24 +0200 Subject: symlinking pinkieoink to oinkoinkoink --- CHANGELOG | 10 +++++++--- manuals/ponysay.texinfo | 17 ++++++++++++----- ponies/pinkieoink.pony | 1 + ponyquotes/ponies | 2 +- ttyponies/pinkieoink.pony | 1 + 5 files changed, 22 insertions(+), 9 deletions(-) create mode 120000 ponies/pinkieoink.pony create mode 120000 ttyponies/pinkieoink.pony diff --git a/CHANGELOG b/CHANGELOG index da945ae..e5136e5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,13 +4,17 @@ Version 2.3 `-q` accepts file names. - Improved Unicode support: treats combining characters as invisible + Improved Unicode support: treats combining characters as invisible. - Optional support for UCS pony names + Optional support for UCS pony names. Pony files and balloon style files can be pipes (as well as sockets, doors and as always regular files.) + Support cowsay style message compression. + + Pony symlink added: pinkieoink → oinkoinkoink + Version 2.2 @@ -73,7 +77,7 @@ Version 1.3 Pony renamed: sindy to powderrouge - Pony symliks: sindy → powderrouge + Pony symlink added: sindy → powderrouge PREFIX=/some-dir can be used when invoking make, the default value is /usr diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 77947aa..0d8c8b1 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -1139,12 +1139,20 @@ Support for @code{best.pony} file. @item @code{-q} accepts file names. @item -Improved Unicode support: treats combining characters as invisible +Improved Unicode support: treats combining characters as invisible. @item -Optional support for UCS pony names +Optional support for UCS pony names. @item Pony files and balloon style files can be pipes (as well as sockets, doors -and as always regular files) +and as always regular files.) +@item +Support cowsay style message compression. +@item +or @command{ponythink} +Pony symlink added: +@itemize @bullet +@item @code{pinkieoink} → @code{oinkoinkoink} +@end itemize @end itemize @heading Version 2.2 @@ -1160,7 +1168,6 @@ 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 @@ -1223,7 +1230,7 @@ Make file is improved. New ponies: @code{forestspirit}, @code{hollydash}, @code{raggedy}, @code{rhyme} @item @code{sindy} is renamed to @code{powderrouge}. -Pony symlinks added: +Pony symlink added: @itemize @bullet @item @code{sindy} → @code{powderrouge} @end itemize diff --git a/ponies/pinkieoink.pony b/ponies/pinkieoink.pony new file mode 120000 index 0000000..7f9fd2b --- /dev/null +++ b/ponies/pinkieoink.pony @@ -0,0 +1 @@ +./oinkoinkoink.pony \ No newline at end of file diff --git a/ponyquotes/ponies b/ponyquotes/ponies index 99b79a2..0834dcd 100644 --- a/ponyquotes/ponies +++ b/ponyquotes/ponies @@ -91,7 +91,7 @@ photofinish pinacolada pinkamina pinkie+pinkiecannonfront+pinkiecannon+pinkiebounce+pinkiecannonhappy+pinkiegala+pinkiechicken+pinkiehugfluttershy+pinkiegummy+pinkietongue+pinkiesilly -pinkie+pinkiepartycannon+pinkieprincess+pinkiehugsfluttershy+pinkiewhoops+oinkoinkoink+pinkiewhoopsout+pinkiewhoopseat+fillypinkie+fillypinkiecurly +pinkie+pinkiepartycannon+pinkieprincess+pinkiehugsfluttershy+pinkiewhoops+oinkoinkoink+pinkiewhoopsout+pinkiewhoopseat+fillypinkie+fillypinkiecurly+pinkieoink pipsqueak pokey+pokeypierce ponet diff --git a/ttyponies/pinkieoink.pony b/ttyponies/pinkieoink.pony new file mode 120000 index 0000000..7f9fd2b --- /dev/null +++ b/ttyponies/pinkieoink.pony @@ -0,0 +1 @@ +./oinkoinkoink.pony \ No newline at end of file -- cgit From 607fafbc3a40a615750e817f5e8b443b062579d8 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 05:16:32 +0200 Subject: manual update --- manuals/ponysay.texinfo | 24 ++++++++++++++++++++++++ ponysay | 15 +++++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 0d8c8b1..6689d5f 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -181,6 +181,13 @@ The argument can be a file name, but pony if it ends with @code{.pony}. Specify the screen column where the message should be wrapped, this is by default 40, which is inherited from @command{cowsay}. +@item -c +@itemx --compress +@cindex @command{-c} +@cindex @command{--compress} +Compress the message in the same way @command{cowsay} does, that is basically +without multiple spaces, one only paragraphs seperations. + @item -l @itemx --list @cindex @command{-l} @@ -346,6 +353,23 @@ Export @code{PONYSAY_TRUNCATE_HEIGHT} with the value @code{yes}, @code{y} or @code{1}, if you want to truncate the output on the height even if you are not running @command{ponysay} under TTY. +@item PONYSAY_UCS_ME +@cindex PONYSAY_UCS_ME +@cindex ucs +@cindex universal character set +@cindex unicode +@cindex ascii +Export @code{PONYSAY_UCS_ME} with the value @code{yes}, @code{y} or @code{1}, +if you want [simulated] symlink to pony files using Universal Character Set +in their names. Otherwise pony files uses only ASCII. If you want to remove +the ASCII:ised names export @code{PONYSAY_UCS_ME} with the value @code{harder}, +@code{h} or @code{2} instead. + +If you have not enabled this, UCS names are not usable, suggested or listed. +If you use @code{yes} UCS names will be usable, suggested or listed. If you +use @code{harder} ASCII:ised names will not be suggested or listed, but they +will still be usable. + @item PONYSAY_COWSAY @itemx PONYSAY_COWTHINK @cindex PONYSAY_COWSAY diff --git a/ponysay b/ponysay index 6b33005..9fc8c70 100755 --- a/ponysay +++ b/ponysay @@ -1639,15 +1639,14 @@ for balloondir in _balloondirs: usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' -usage_wrap = '--wrap \033[4mCOLUMN\033[24m' -usage_balloon = '--balloon \033[4mSTYLE\033[24m' -usage_listhelp = '(--list | --altlist | --balloonlist | --version | --help)' -usage_file = '[--pony \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' -usage_quote = '--quote [\033[4mPONY\033[24m...]' +usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' +usage_listhelp = '(-l | -L | -B | -v | -h)' +usage_file = '[-f \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' +usage_quote = '-q [\033[4mPONY\033[24m...]' -usage = '%s %s\n%s [%s] [%s] %s\n%s [%s] [%s] %s' % (usage_saythink, usage_listhelp, - usage_saythink, usage_wrap, usage_balloon, usage_file, - usage_saythink, usage_wrap, usage_balloon, usage_quote) +usage = '%s %s\n%s %s %s\n%s %s %s' % (usage_saythink, usage_listhelp, + usage_saythink, usage_common, usage_file, + usage_saythink, usage_common, usage_quote) usage = usage.replace('\033[', '\0') for sym in ('[', ']', '(', ')', '|', '...'): -- cgit From d378b2bc588734020a76c74b2209f0288df4cc8d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 12:50:29 +0200 Subject: pdf build --- ponysay.pdf | Bin 346972 -> 348254 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/ponysay.pdf b/ponysay.pdf index d34e77b..6aa609e 100644 Binary files a/ponysay.pdf and b/ponysay.pdf differ -- cgit From 808ce84ed903bad12bb0b71bfc14a417fb147b6e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 15:24:04 +0200 Subject: info update --- manuals/ponysay.texinfo | 77 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 10 deletions(-) diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 6689d5f..f6735fa 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -143,6 +143,10 @@ specify a set of ponies from which one will be selected randomly. If no pony is specified one will be selected randomly. @cindex @command{util-say} +@cindex .png +@cindex png images +@cindex images, png +@cindex portable network graphics If you have @command{util-say} installed, you can use .png-files as the arguments for this options. @@ -185,8 +189,12 @@ this is by default 40, which is inherited from @command{cowsay}. @itemx --compress @cindex @command{-c} @cindex @command{--compress} +@cindex figlet +@cindex toilet Compress the message in the same way @command{cowsay} does, that is basically -without multiple spaces, one only paragraphs seperations. +without multiple spaces, one only paragraphs seperations. Using this options +will mean that you cannot display @command{filet} and @command{TOIlet} style +messages. @item -l @itemx --list @@ -475,12 +483,6 @@ look different, maybe using box drawing characters. on the balloon–pony links. or any other placement of the balloon than at the top to the left. -@cindex figlet -@cindex toilet -@command{cowsay}'s word wrapping handles single line breaks as normal blank spaces, -this messes up messages created with programs such as @command{figlet} and @command{TOIlet}. - - @node Problems and requests @@ -553,6 +555,7 @@ This is a wrapper for @command{cowsay}. For improved TTY support for user with custom colour palette and KMS support. It can be downloaded at @url{https://github.com/maandree/util-say}. +@cindex .png @cindex png images @cindex images, png @cindex portable network graphics @@ -851,10 +854,11 @@ but is still available at @url{https://github.com/maandree/kmsponies4ponysay}. * Pony anatomy:: Anatomy of pony files. * Pony quote infrastructure:: Pony quote infrastructure. * Balloon style files:: Balloon style files. -* Printing in TTY with KMS:: Printing in TTY with KMS. +* Printing in TTY with KMS:: Printing in TTY with KMS support. * Truncation:: Output truncation. -* Languages:: Selection of languages. -* Shell auto-completion:: Things make auto-completion simpler. +* Languages:: Selection of programming languages. +* Shell auto-completion:: Things that make auto-completion simpler. +* Universal Character Set:: Something about Univeral Character Set support. @end menu @@ -1075,6 +1079,30 @@ but does not exist, i.e. does not have a .pony-file, are not listed. Auto-completion scripts should not suggest these options. +@node Universal Character Set +@section Universal Character Set +@cindex universal character set +@cindex ucs +@cindex unicode +@cindex pony names + +In earlier versions of @command{ponysay} only the output truncationed supported +Universal Character Set, though handcoded UTF-8 character counting. Now @command{ponysay} +lets Python decode the data, Python store all 31 bits of a character in as one +character, not in UTF-16 as some other languages does, this means that the code +is agnostic to the chararacter encoding. However in Unicode 6.1 their are four ranges +of combining characters, these do not take up any width in proper terminal, we +their for have a class in the code named @code{UCS} that help us take them into +consideration when determine the length of strings. + +Some ponies have names contains non-ASCII characters, read about it in +@ref{Environment variables}. The UCS names are stored in the file @code{share/ucsmap}, +in it lines that are not empty and does not start with a hash (@code{#}) are parse, and +contains a UCS name and a ASCII:ised name. The UCS name comes first, followed by the +ASCII:ised name that it should replace or link to. The two names are separated by and +simple left to right arrow character [U+2192], optionally with surrounding white space. + + @node Contributing @chapter Contributing @@ -1125,6 +1153,35 @@ For more information see: @end example @* +@cindex util-say +@cindex .png +@cindex png images +@cindex images, png +@cindex portable network graphics +If you have util-say installed, which is required to build ponies, you can run @code{.png} +files as argument for @command{ponysay -f}, this required that the file is named @code{.png} +at the end. + +@cindex palette +@cindex xterm palette +@cindex pony palette +@cindex colour palette +The following @code{bash} code will print the palette the ponies (the terminals) use. +@example +c=16 +while ((c < 256)); do + echo -en "\e[48;5;${c}m \e[49m" + c=$(( $c + 1 )) + if (( $(( c % 36 )) == 16 )); then + echo + fi +done; echo +@end example + +@* +For the palette to be correct, which is especially important when you draw ponies, you +must not redefine the colours in the range 16 to 255 (inclusive). + @cindex ttypony When a pony is added please also add a ttypony version, i.e. the pony files used in TTY, but if you don't please state so in the pull request so we do not miss the create it; -- cgit From cbbb9be76c7ab4d7bec9c7f7afea3dda8fd949b6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 15:50:42 +0200 Subject: Non-TV ponies --- configure | 35 +++++++++++++++++++++++++---------- extraponies/.info | 3 +++ extrattyponies/.info | 3 +++ ponysay | 51 +++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 72 insertions(+), 20 deletions(-) create mode 100644 extraponies/.info create mode 100644 extrattyponies/.info diff --git a/configure b/configure index 6f8b57d..5c63dd3 100755 --- a/configure +++ b/configure @@ -6,7 +6,7 @@ INFODESC=\''My Little Ponies for your terminal'\' SHELL='bash' completions='completion/bash-completion.sh completion/fish-completion.fish completion/zsh-completion.zsh' -shareDirs='ponies ttyponies quotes balloons' +shareDirs='ponies ttyponies quotes balloons extraponies extrattyponies' manFiles='manuals/manpage.6 manuals/manpage.es.6' licenseFiles='COPYING' @@ -360,15 +360,30 @@ EOF ttyponies: mkdir -p "ttyponies" - for pony in \$\$(ls --color=no "ponies/"); do \\ - echo "building ttypony: \$\$pony" ;\\ - if [ "\`readlink "ponies/\$\$pony"\`" = '' ]; then \\ - ponysay2ttyponysay < "ponies/\$\$pony" | tty2colourfultty -c 1 > "ttyponies/\$\$pony" ;\\ - git add "ttyponies/\$\$pony" ;\\ - else \\ - ln -sf \`readlink "ponies/\$\$pony"\` "ttyponies/\$\$pony" ;\\ - git add "ttyponies/\$\$pony" ;\\ - fi ;\\ + for pony in \$\$(ls --color=no "ponies/"); do \\ + if [ 1 "\$\$pony" = '.info' ]; then \\ + echo "building ttypony: \$\$pony" ;\\ + if [ "\`readlink "ponies/\$\$pony"\`" = '' ]; then \\ + ponysay2ttyponysay < "ponies/\$\$pony" | tty2colourfultty -c 1 > "ttyponies/\$\$pony" ;\\ + git add "ttyponies/\$\$pony" ;\\ + else \\ + ln -sf \`readlink "ponies/\$\$pony"\` "ttyponies/\$\$pony" ;\\ + git add "ttyponies/\$\$pony" ;\\ + fi ;\\ + fi ;\\ + done + mkdir -p "extrattyponies" + for pony in \$\$(ls --color=no "extraponies/"); do \\ + if [ 1 "\$\$pony" = '.info' ]; then \\ + echo "building extrattypony: \$\$pony" ;\\ + if [ "\`readlink "extraponies/\$\$pony"\`" = '' ]; then \\ + ponysay2ttyponysay < "extraponies/\$\$pony" | tty2colourfultty -c 1 > "extrattyponies/\$\$pony" ;\\ + git add "extrattyponies/\$\$pony" ;\\ + else \\ + ln -sf \`readlink "extraponies/\$\$pony"\` "extrattyponies/\$\$pony" ;\\ + git add "extrattyponies/\$\$pony" ;\\ + fi ;\\ + fi ;\\ done pdfmanual: diff --git a/extraponies/.info b/extraponies/.info new file mode 100644 index 0000000..12d5bea --- /dev/null +++ b/extraponies/.info @@ -0,0 +1,3 @@ +Dummy file for this directory as it is otherwise empty. + +Non-MLP:FiM ponies should be placed here. diff --git a/extrattyponies/.info b/extrattyponies/.info new file mode 100644 index 0000000..333e827 --- /dev/null +++ b/extrattyponies/.info @@ -0,0 +1,3 @@ +Dummy file for this directory as it is otherwise empty. + +Non-MLP:FiM ttyponies should be placed here. diff --git a/ponysay b/ponysay index 9fc8c70..62f6834 100755 --- a/ponysay +++ b/ponysay @@ -58,14 +58,24 @@ class Ponysay(): else: self.__bestpony(args) self.__ucsremap(args) + self.__extraponies(args) if args.opts['-q'] is not None: self.quote(args) else: self.print_pony(args) ## - ## Auxiliary methods + ## Methods that run in the beginning of non-listing and non-help stuff ## + ''' + Use best.pony if nothing else is set + ''' + def __bestpony(self, args): + if args.opts['-F'] is not None: + args.opts['-f'] = args.opts['-F'] + ponydirs = extraponydirs + + ''' Use best.pony if nothing else is set ''' @@ -118,6 +128,10 @@ class Ponysay(): args.opts[flag][i] = map[args.opts[flag][i]] + ## + ## Auxiliary methods + ## + ''' Apply USC:ise pony names according to UCS settings ''' @@ -1596,6 +1610,12 @@ Whether stderr is piped pipelineerr = not sys.stderr.isatty() +''' +Whether KMS is used +''' +usekms = Ponysay.isUsingKMS() + + ''' Root share/ directories ''' @@ -1607,17 +1627,27 @@ for sharedir in _sharedirs: ''' -The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY) +The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY) and not with KMS ''' ponydirs = [] -_kms = Ponysay.isUsingKMS() -if linuxvt and not _kms: _ponydirs = [d + 'ttyponies/' for d in sharedirs] -else: _ponydirs = [d + 'ponies/' for d in sharedirs] +if linuxvt and not usekms: _ponydirs = [d + 'ttyponies/' for d in sharedirs] +else: _ponydirs = [d + 'ponies/' for d in sharedirs] for ponydir in _ponydirs: if os.path.isdir(ponydir): ponydirs.append(ponydir) +''' +The directories where pony files are stored, extrattyponies/ are used if the terminal is Linux VT (also known as TTY) and not with KMS +''' +extraponydirs = [] +if linuxvt and not usekms: _extraponydirs = [d + 'extrattyponies/' for d in sharedirs] +else: _extraponydirs = [d + 'extraponies/' for d in sharedirs] +for extraponydir in _extraponydirs: + if os.path.isdir(extraponydir): + extraponydirs.append(extraponydir) + + ''' The directories where quotes files are stored ''' @@ -1638,11 +1668,11 @@ for balloondir in _balloondirs: balloondirs.append(balloondir) -usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' -usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' -usage_listhelp = '(-l | -L | -B | -v | -h)' -usage_file = '[-f \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' -usage_quote = '-q [\033[4mPONY\033[24m...]' +usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' +usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' +usage_listhelp = '(-l | -L | -B | -v | -h)' +usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' +usage_quote = '-q [\033[4mPONY\033[24m...]' usage = '%s %s\n%s %s %s\n%s %s %s' % (usage_saythink, usage_listhelp, usage_saythink, usage_common, usage_file, @@ -1677,6 +1707,7 @@ opts.add_argumentless(['-c', '--compact'], help = opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.') opts.add_argumented( ['-b', '--bubble', '--balloon'], arg = 'STYLE', help = 'Select a balloon style.') opts.add_argumented( ['-f', '--file', '--pony'], arg = 'PONY', help = 'Select a pony.\nEither a file name or a pony name.') +opts.add_argumented( ['-F', '++file', '++pony'], arg = 'PONY', help = 'Select a non-MLP:FiM pony.') opts.add_variadic( ['-q', '--quote'], arg = 'PONY', help = 'Select a ponies which will quote themself.') opts.parse() -- cgit From 243612379e077eb46159cb64df51de2489b5c67f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 15:56:48 +0200 Subject: Non-TV ponies fix --- ponysay | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ponysay b/ponysay index 62f6834..f4480c0 100755 --- a/ponysay +++ b/ponysay @@ -56,24 +56,24 @@ class Ponysay(): elif args.opts['-L'] is not None: self.linklist() elif args.opts['-B'] is not None: self.balloonlist() else: + self.__extraponies(args) self.__bestpony(args) self.__ucsremap(args) - self.__extraponies(args) if args.opts['-q'] is not None: self.quote(args) else: self.print_pony(args) ## - ## Methods that run in the beginning of non-listing and non-help stuff + ## Methods that run before the mane methods ## ''' - Use best.pony if nothing else is set + Use extra ponies ''' - def __bestpony(self, args): + def __extraponies(self, args): if args.opts['-F'] is not None: args.opts['-f'] = args.opts['-F'] - ponydirs = extraponydirs + ponydirs[:] = extraponydirs ''' @@ -1668,11 +1668,11 @@ for balloondir in _balloondirs: balloondirs.append(balloondir) -usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' -usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' -usage_listhelp = '(-l | -L | -B | -v | -h)' -usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' -usage_quote = '-q [\033[4mPONY\033[24m...]' +usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' +usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' +usage_listhelp = '(-l | -L | -B | -v | -h)' +usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' +usage_quote = '-q [\033[4mPONY\033[24m...]' usage = '%s %s\n%s %s %s\n%s %s %s' % (usage_saythink, usage_listhelp, usage_saythink, usage_common, usage_file, -- cgit From a84f1d6534515e3264b6e87d9f13568de98feade Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:01:37 +0200 Subject: listing extra ponies --- ponysay | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ponysay b/ponysay index f4480c0..baea15c 100755 --- a/ponysay +++ b/ponysay @@ -55,6 +55,9 @@ class Ponysay(): elif args.opts['-l'] is not None: self.list() elif args.opts['-L'] is not None: self.linklist() elif args.opts['-B'] is not None: self.balloonlist() + elif args.opts['++onelist'] is not None: self.__extraponies(); self.onelist() + elif args.opts['+l'] is not None: self.__extraponies(); self.list() + elif args.opts['+L'] is not None: self.__extraponies(); self.linklist() else: self.__extraponies(args) self.__bestpony(args) @@ -70,8 +73,10 @@ class Ponysay(): ''' Use extra ponies ''' - def __extraponies(self, args): - if args.opts['-F'] is not None: + def __extraponies(self, args = None): + if args is None: + ponydirs[:] = extraponydirs + elif args.opts['-F'] is not None: args.opts['-f'] = args.opts['-F'] ponydirs[:] = extraponydirs @@ -1697,11 +1702,14 @@ run `man ponysay`. Ponysay has so much more to offer than described here.''') opts.add_argumentless(['--quoters']) opts.add_argumentless(['--onelist']) +opts.add_argumentless(['++onelist']) opts.add_argumentless(['-h', '--help'], help = 'Print this help message.') opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.') opts.add_argumentless(['-l', '--list'], help = 'List pony names.') opts.add_argumentless(['-L', '--altlist'], help = 'List pony names with alternatives.') +opts.add_argumentless(['+l', '++list'], help = 'List non-MLP:FiM pony names.') +opts.add_argumentless(['+L', '++altlist'], help = 'List non-MLP:FiM pony names with alternatives.') opts.add_argumentless(['-B', '--balloonlist'], help = 'List balloon styles.') opts.add_argumentless(['-c', '--compact'], help = 'Compress messages.') opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.') -- cgit From f830ba4cf7b21b50406fbccf32535ebda11c2ed9 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:25:35 +0200 Subject: misc --- CHANGELOG | 3 ++ completion/bash-completion.sh | 8 +++-- completion/fish-completion.fish | 5 ++++ completion/zsh-completion.zsh | 5 +++- manuals/ponysay.texinfo | 66 +++++++++++++++++++++++++++++++++++++---- ponysay | 2 +- 6 files changed, 79 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e5136e5..d893033 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,9 @@ Version 2.3 Pony symlink added: pinkieoink → oinkoinkoink + Support for non-MLP:FiM ponies (known as extraponies), + although the directory is currently empty. + Version 2.2 diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index 72cafcb..62e1d40 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -5,13 +5,17 @@ _ponysay() local cur prev words cword _init_completion -n = || return - options='--version --help --list --altlist --pony --wrap --quote --balloonlist --balloon' + options='--version --help --list --altlist --pony --wrap --quote --balloonlist --balloon --file ++file ++pony ++list ++altlist' COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) - if [ $prev = "-f" ] || [ $prev = "--pony" ]; then + if [ $prev = "-f" ] || [ $prev = "--pony" ] || [ $prev = "--file" ]; then ponies=$('/usr/bin/ponysay' --onelist) COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) ) + elif [ $prev = "-F" ] || [ $prev = "++pony" ] || [ $prev = "++file" ]; then + extraponies=$('/usr/bin/ponysay' ++onelist) + COMPREPLY=( $( compgen -W "$extraponies" -- "$cur" ) ) + elif [ $prev = "-q" ] || [ $prev = "--quote" ]; then quoters=$('/usr/bin/ponysay' --quoters) COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) ) diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish index c211982..c29fff2 100644 --- a/completion/fish-completion.fish +++ b/completion/fish-completion.fish @@ -4,21 +4,26 @@ # Author: Elis Axelsson set -g ponies ('/usr/bin/ponysay' --onelist) +set -g xponies ('/usr/bin/ponysay' ++onelist) set -g quoters ('/usr/bin/ponysay' --quoters) set -g balloons ('/usr/bin/ponysay' --balloonlist) +## TODO: update with options [see info manual]: +l +L ++list ++altlist ++file --file ++pony complete --command ponysay --short-option h --long-option help --description 'help of ponysay' complete --command ponysay --short-option v --long-option version --description 'version of ponysay' complete --command ponysay --short-option l --long-option list --description 'list pony names' complete --command ponysay --short-option L --long-option altlist --description 'list pony names with alternatives' complete --command ponysay --short-option B --long-option balloonlist --description 'list balloon style names' complete --command ponysay --short-option f --long-option pony --arguments "$ponies" --description 'pony' +complete --command ponysay --short-option F --arguments "$xponies" --description 'extra pony' complete --command ponysay --short-option q --long-option quote --arguments "$quoters" --description 'pony' complete --command ponysay --short-option b --long-option balloon --arguments "$balloons" --description 'balloon style' complete --command ponysay --short-option W --long-option wrap --arguments 'Integer' --description 'specify the column when the message should be wrapped' complete --command ponysay --arguments 'MESSAGE' + set -e ponies +set -e xponies set -e quoters set -e balloons diff --git a/completion/zsh-completion.zsh b/completion/zsh-completion.zsh index c19604d..9d417ec 100644 --- a/completion/zsh-completion.zsh +++ b/completion/zsh-completion.zsh @@ -4,8 +4,11 @@ _shortopts=( '-h[Show this help and exit]' '-l[list pony names]' '-L[list pony names with alternatives]' + '+l[list extra pony names]' + '+L[list extra pony names with alternatives]' '-B[list balloon style names]' - '-f[Select a pony (either a file name or a pony name]: :_path_files -W '/usr/share/ponysay/ponies' -g "*(\:r)"' + '-f[Select a pony (either a file name or a pony name)]: :_path_files -W '/usr/share/ponysay/ponies' -g "*(\:r)"' + '-F[Select a extra pony]: :_path_files -W '/usr/share/ponysay/extraponies' -g "*(\:r)"' '-q[Select ponies for MLP:FiM quotes]' '-b[Selecy a balloon style]' '-W[The screen column where the message should be wrapped]' diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 6689d5f..312a542 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -150,6 +150,15 @@ 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 pony name supersedes file names. +@item -F +@itemx ++file PONY +@itemx ++pony PONY +@cindex @command{-F} +@cindex @command{++file} +@cindex @command{++pony} +Just as @command{-F}, but it uses extra (non-MLP:FiM) ponies instead of +standard (MLP:FiM) ponies + @item -b STYLE @itemx --bubble STYLE @itemx --balloon STYLE @@ -198,7 +207,7 @@ is installed the ponies which have quotes, i.e. can be used with the (depending on the terminal.) @item -L -@itemx --linklist +@itemx --altlist @cindex @command{-L} @cindex @command{--altlist} Lists all installed ponies. If the extension @command{ponyquotes4ponysay} @@ -208,6 +217,20 @@ is installed the ponies which have quotes, i.e. can be used with the printing alternative names (symbolic links) inside brackets after their target ponies. +@item +l +@itemx ++list +@cindex @command{+l} +@cindex @command{++list} +Just as @command{-l}, but it lists extra (non-MLP:FiM) ponies instead of +standard (MLP:FiM) ponies + +@item +L +@itemx ++altlist +@cindex @command{+L} +@cindex @command{++altlist} +Just as @command{-L}, but it lists extra (non-MLP:FiM) ponies instead of +standard (MLP:FiM) ponies + @item -B @itemx --balloonlist @cindex @command{-B} @@ -1058,14 +1081,19 @@ and only use Python 3, which as been accomplished in version 2.1. @cindex auto-completion, inner workings @cindex shell, auto-completion @cindex @command{--onelist} +@cindex @command{++onelist} @cindex @command{--quoters} To make it easier to write auto-completion for shells, @command{ponysay} supports -the two options @command{--onelist} and @command{--quoters}, which has not short -versions. +the two options @command{--onelist}, @command{++onelist} and @command{--quoters}, +which has nt short versions. -Executing @command{ponysay --onelist} will list every available pony, -independent of where it is located, the output is a sorted and consists only +Executing @command{ponysay --onelist} will list every available standard (MLP:FiM) +pony, independent of where it is located, the output is a sorted and consists only +of one pony per line. + +Executing @command{ponysay ++onelist} will list every available extra (non-MLP:FiM) +pony, independent of where it is located, the output is a sorted and consists only of one pony per line. @command{ponysay --quoters} work just as @command{ponysay --onelist}, excepts @@ -1172,13 +1200,20 @@ and as always regular files.) @item Support cowsay style message compression. @item -or @command{ponythink} Pony symlink added: @itemize @bullet @item @code{pinkieoink} → @code{oinkoinkoink} @end itemize +@item +Support for non-MLP:FiM ponies (known as extraponies), although the directory +is currently empty. +@c BEGIN the following is too descriptive for the plain/text change log +This is implemented with the options @code{-F}, @code{+l}, and @code{+L} +corresponding to @code{-f}, @code{-l}, and @code{-L}. +@c END @end itemize + @heading Version 2.2 @itemize @bullet @@ -1194,10 +1229,12 @@ 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} @end itemize + @heading Version 2.1.1 Nothing worth mention. + @heading Version 2.1 @itemize @bullet @@ -1221,6 +1258,7 @@ minimum size of balloon. @c END @end itemize + @heading Version 2.0 @itemize @bullet @@ -1232,12 +1270,14 @@ All Perl scripts and almost all Bash are reimplemented in one Python 3 script. kmsponies4ponysay is included. @end itemize + @heading Version 1.4.1 @itemize @bullet @item Code is repaired and more portable. @end itemize + @heading Version 1.4 @itemize @bullet @@ -1247,6 +1287,7 @@ Make file is improved. @b{Note}: Identifies itself as version 1.3 + @heading Version 1.3 @itemize @bullet @@ -1263,6 +1304,7 @@ Pony symlink added: the default value is @code{/usr} @end itemize + @heading Version 1.2 @itemize @bullet @@ -1290,6 +1332,7 @@ file names including spaces.) @b{Note}: Identifies itself as version 1.1 + @heading Version 1.1 @itemize @bullet @@ -1338,6 +1381,7 @@ Support for extension: ponyquotes4ponysay. Accepts arbitrary spaces in @command{-f} argument. @end itemize + @heading Version 1.0 @itemize @bullet @@ -1368,6 +1412,7 @@ Improved TTY support: ponies have low colours resolution, instead of monochrome, when the high colour resolution is not available. @end itemize + @heading Version 0.10 @itemize @bullet @@ -1399,6 +1444,7 @@ Environment variables added: @code{PONYSAY_FULL_WIDTH}, @code{PONYSAY_SHELL_LINE @code{PONYSAY_TRUNCATE_HEIGHT}, @code{PONYSAY_BOTTOM}. @end itemize + @heading Version 0.9 @itemize @bullet @@ -1418,6 +1464,7 @@ Support for TTY (Linux VT). @code{sparkler}, @code{violet}. @end itemize + @heading Version 0.8 @itemize @bullet @@ -1447,6 +1494,7 @@ Support for TTY (Linux VT). @b{Note}: Identifies itself as version 0.7 + @heading Version 0.7 @itemize @bullet @@ -1457,6 +1505,7 @@ Support for TTY (Linux VT). Support for listing ponies with @command{-l} option. @end itemize + @heading Version 0.6 @itemize @bullet @@ -1469,6 +1518,7 @@ Dropping usage of utility @command{which}, using @command{hash} instead. @b{Note}: Identifies itself as version 0.5 + @heading Version 0.5 @itemize @bullet @@ -1476,6 +1526,7 @@ Dropping usage of utility @command{which}, using @command{hash} instead. Using utility @command{which} to determine existence of @command{cowsay}. @end itemize + @heading Version 0.4 @itemize @bullet @@ -1491,6 +1542,7 @@ Select random pony if not specified. @command{-f} supports file names, and not only pony names. @end itemize + @heading Version 0.3 @itemize @bullet @@ -1498,6 +1550,7 @@ Select random pony if not specified. Fixed use of @code{.pony} files. @end itemize + @heading Version 0.2 @itemize @bullet @@ -1512,6 +1565,7 @@ Pony files end with @code{.pony} instead of @code{.cow}. @command{-h} prints proper help. @end itemize + @heading Version 0.1 First release. diff --git a/ponysay b/ponysay index baea15c..67a7d2e 100755 --- a/ponysay +++ b/ponysay @@ -1675,7 +1675,7 @@ for balloondir in _balloondirs: usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' -usage_listhelp = '(-l | -L | -B | -v | -h)' +usage_listhelp = '(-l | -L | -B | +l | +L | -v | -h)' usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' usage_quote = '-q [\033[4mPONY\033[24m...]' -- cgit From 19f2a5a8a49c590164d1ba02af33347add9b68fb Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:29:37 +0200 Subject: make fix for extra ponies --- configure | 2 +- extraponies/.info | 3 --- extraponies/info | 3 +++ extrattyponies/.info | 3 --- extrattyponies/info | 3 +++ 5 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 extraponies/.info create mode 100644 extraponies/info delete mode 100644 extrattyponies/.info create mode 100644 extrattyponies/info diff --git a/configure b/configure index 5c63dd3..de1ab00 100755 --- a/configure +++ b/configure @@ -224,7 +224,7 @@ function makeMakefile() echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/"' for dir in $shareDirs; do echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/'"$dir"'"' - echo -en '\t' ; echo 'cp -P "'"$dir"'/"*.* "$(INSTALLDIR)/share/ponysay/'"$dir"'/"' + echo -en '\t' ; echo 'cp -P "'"$dir"'/"* "$(INSTALLDIR)/share/ponysay/'"$dir"'/"' done echo echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/bin/"' diff --git a/extraponies/.info b/extraponies/.info deleted file mode 100644 index 12d5bea..0000000 --- a/extraponies/.info +++ /dev/null @@ -1,3 +0,0 @@ -Dummy file for this directory as it is otherwise empty. - -Non-MLP:FiM ponies should be placed here. diff --git a/extraponies/info b/extraponies/info new file mode 100644 index 0000000..12d5bea --- /dev/null +++ b/extraponies/info @@ -0,0 +1,3 @@ +Dummy file for this directory as it is otherwise empty. + +Non-MLP:FiM ponies should be placed here. diff --git a/extrattyponies/.info b/extrattyponies/.info deleted file mode 100644 index 333e827..0000000 --- a/extrattyponies/.info +++ /dev/null @@ -1,3 +0,0 @@ -Dummy file for this directory as it is otherwise empty. - -Non-MLP:FiM ttyponies should be placed here. diff --git a/extrattyponies/info b/extrattyponies/info new file mode 100644 index 0000000..333e827 --- /dev/null +++ b/extrattyponies/info @@ -0,0 +1,3 @@ +Dummy file for this directory as it is otherwise empty. + +Non-MLP:FiM ttyponies should be placed here. -- cgit From d3ddf64433b38558a4dc83eba36469a971dd9640 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:36:47 +0200 Subject: final touches on extra ponies --- ponysay | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ponysay b/ponysay index 67a7d2e..faca1d3 100755 --- a/ponysay +++ b/ponysay @@ -282,8 +282,6 @@ class Ponysay(): quoters = self.__quoters() for ponydir in ponydirs: # Loop ponydirs - print('\033[1mponies located in ' + ponydir + '\033[21m') - _ponies = os.listdir(ponydir) ponies = [] for pony in _ponies: @@ -292,6 +290,10 @@ class Ponysay(): self.__ucsise(ponies) ponies.sort() + if len(ponies) == 0: + continue + print('\033[1mponies located in ' + ponydir + '\033[21m') + width = UCS.dispLen(max(ponies, key = UCS.dispLen)) + 2 # Get the longest ponyfilename lenght + 2 spaces x = 0 @@ -314,13 +316,16 @@ class Ponysay(): quoters = self.__quoters() for ponydir in ponydirs: # Loop ponydirs - print('\033[1mponies located in ' + ponydir + '\033[21m') - _ponies = os.listdir(ponydir) ponies = [] for pony in _ponies: if (len(pony) > 5) and (pony[-5:] == '.pony'): ponies.append(pony[:-5]) + + if len(ponies) == 0: + continue + print('\033[1mponies located in ' + ponydir + '\033[21m') + pseudolinkmap = {} self.__ucsise(ponies, pseudolinkmap) ##TODO pairs = [] -- cgit From 298e6a6498267af28712a178ad2aadf59e60facd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:39:40 +0200 Subject: pdf update --- ponysay.pdf | Bin 348254 -> 353647 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/ponysay.pdf b/ponysay.pdf index 6aa609e..ce6f040 100644 Binary files a/ponysay.pdf and b/ponysay.pdf differ -- cgit From f7790b8f2263b89b21dc91695cee1df70aab368e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:59:01 +0200 Subject: manual update, Spanish most likely needs correction (I guessed the grammar) --- manuals/manpage.6 | 10 ++++++++++ manuals/manpage.es.6 | 11 ++++++++++- manuals/ponysay.texinfo | 3 ++- ponysay.pdf | Bin 353647 -> 353706 bytes 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/manuals/manpage.6 b/manuals/manpage.6 index 4d1f121..f623b97 100644 --- a/manuals/manpage.6 +++ b/manuals/manpage.6 @@ -58,10 +58,20 @@ List pony files. .B \-L List pony files with alternative names inside brackets. .TP +.B \+l +List non-MLP:FiM pony files. +.TP +.B \+L +List non-MLP:FiM pony files with alternative names inside brackets. +.TP .B \-f \fIname\fP 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 \-F \fIname\fP +Select a non-MLP:FiM 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 \-q [\fIname\fP...] By using this option, a pony will be printed with quotes from her in My Little Pony: Friendship is Magic. The pony will be selected randomly, unless at least one pony diff --git a/manuals/manpage.es.6 b/manuals/manpage.es.6 index 3a13193..221a59c 100644 --- a/manuals/manpage.es.6 +++ b/manuals/manpage.es.6 @@ -58,8 +58,17 @@ Lista los ponis disponibles. .B \-L Lista los ponis con nombres alternativos dentro de paréntesis. .TP +.B \+l +Lista los ponis no MLP:FiM disponibles. +.TP +.B \+L +Lista los ponis no MLP:FiM con nombres alternativos dentro de paréntesis. +.TP .B \-f \fInombre\fP -selecciona un poni específico (ya sea un archivo o el nombre directamente), puedes usar esta opción con múltiples ponis y de estos será elejído uno al azar. +Selecciona un poni específico (ya sea un archivo o el nombre directamente), puedes usar esta opción con múltiples ponis y de estos será elejído uno al azar. +.TP +.B \-F \fInombre\fP +Selecciona un poni no MLP:FiM específico (ya sea un archivo o el nombre directamente), puedes usar esta opción con múltiples ponis y de estos será elejído uno al azar. .TP .B \-q [\fInombre\fP...] Usando esta opción un poni será mostrado dando una cita de My Little Pony: Frienship is magic diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index c0d3633..d9b416e 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -1172,7 +1172,8 @@ Using util-say: @example img2ponysay -2 -- SOURCE_IMAGE > PONY_FILE -PONY_FILE should end with .pony and be localed in ponies/ +PONY_FILE should end with .pony and be localed in ponies/, +or extraponies/ if the pony is not a MLP:FiM pony. Omit -2 if the source image does not use double pixel size. diff --git a/ponysay.pdf b/ponysay.pdf index ce6f040..98b8f36 100644 Binary files a/ponysay.pdf and b/ponysay.pdf differ -- cgit From 2f1fd9e47dd5c6a217660e4c1a7e5eaf587c3b62 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 17:34:24 +0200 Subject: FAQ update (TTY + the new pony format) --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cfdc614..f2a342b 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ FAQ __Q:__ The output looks like a mess in _(TTY/PuTTY/other)_! -__A:__ Unfortunately, there's nothing much we can do about it. See [issue 1](/erkin/ponysay/issues/1). +__A:__ Unfortunately we cannot make it perfect, see [issue 1](/erkin/ponysay/issues/1). But we have done a lot, read more about how to get the best the current state of the art has to offer in out the [manual](https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true). __Q:__ You are missing _(my-favourite-pony)_! @@ -106,5 +106,6 @@ __A:__ [Ask](/erkin/ponysay/issues) and we'll add! __Q:__ Which programs do you use to generate the pony files? -__A:__ The pony files are actually mostly a bunch of selected [browser ponies](http://web.student.tuwien.ac.at/~e0427417/browser-ponies/ponies.html) -that are generated into cow files via [img2xterm](/rossy2401/img2xterm) or [util-say](/maandree/util-say). +__A:__ The pony files are actually mostly a bunch of selected [browser ponies](http://web.student.tuwien.ac.at/~e0427417/browser-ponies/ponies.html), converted using [util-say](/maandree/util-say). + +The [PDF manual](https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true) should answer most of your questions. \ No newline at end of file -- cgit From a3a37d153d96344cf9b2854d18f122fdda9f041f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 17:36:33 +0200 Subject: m --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f2a342b..d8fedb5 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ FAQ __Q:__ The output looks like a mess in _(TTY/PuTTY/other)_! -__A:__ Unfortunately we cannot make it perfect, see [issue 1](/erkin/ponysay/issues/1). But we have done a lot, read more about how to get the best the current state of the art has to offer in out the [manual](https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true). +__A:__ Unfortunately we cannot make it perfect, see [issue 1](/erkin/ponysay/issues/1). But we have done a lot, read more about how to get the best the current state of the art has to offer in the [manual](/erkin/ponysay/blob/master/ponysay.pdf?raw=true). __Q:__ You are missing _(my-favourite-pony)_! @@ -106,6 +106,6 @@ __A:__ [Ask](/erkin/ponysay/issues) and we'll add! __Q:__ Which programs do you use to generate the pony files? -__A:__ The pony files are actually mostly a bunch of selected [browser ponies](http://web.student.tuwien.ac.at/~e0427417/browser-ponies/ponies.html), converted using [util-say](/maandree/util-say). +__A:__ The pony files are actually mostly a bunch of selected [browser ponies](//web.student.tuwien.ac.at/~e0427417/browser-ponies/ponies.html), converted using [util-say](/maandree/util-say). -The [PDF manual](https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true) should answer most of your questions. \ No newline at end of file +The [PDF manual](/erkin/ponysay/blob/master/ponysay.pdf?raw=true) should answer most of your questions. -- cgit From 9fe400348a2010f7e82ba8f969402016efa98913 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 17:38:13 +0200 Subject: dependency update fix --- manuals/ponysay.texinfo | 2 -- ponysay.pdf | Bin 353706 -> 353650 bytes 2 files changed, 2 deletions(-) diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index d9b416e..24633aa 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -556,8 +556,6 @@ properties that makes a picture good. @section Required runtime dependencies @table @option -@item cowsay -This is a wrapper for @command{cowsay}. @item coreutils @command{stty} is used to determine the size of the terminal. @item python diff --git a/ponysay.pdf b/ponysay.pdf index 98b8f36..072c22b 100644 Binary files a/ponysay.pdf and b/ponysay.pdf differ -- cgit From 4fcd0b284ff296b41e08056c2dbf35de614e0320 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 20:30:21 +0200 Subject: misc info manual --- manuals/ponysay.texinfo | 897 +++++++++++++++++++++++++----------------------- ponysay.pdf | Bin 353650 -> 361698 bytes 2 files changed, 476 insertions(+), 421 deletions(-) diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 24633aa..0bbe1b3 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -34,7 +34,7 @@ Texts. A copy of the license is included in the section entitled @titlepage @title Ponysay -@subtitle A cowsay wrapper for ponies. +@subtitle Infesting your terminal with ponies. @subtitle Covers ponysay version @value{VERSION}. @c ** start of front page image ** @c If print make a pdf or hard copy with the front cover @@ -46,6 +46,9 @@ Texts. A copy of the license is included in the section entitled @page @vskip 0pt plus 1filll @insertcopying +@page +@*@* +@center{`For me! For my friends! @b{For EQUESTRIA!}'} @end titlepage @contents @@ -55,14 +58,15 @@ Texts. A copy of the license is included in the section entitled * Overview:: Brief overview of @command{ponysay}. * Invoking ponysay:: How to run @command{ponysay}. * Advanced usage:: Advanced usage of @command{ponysay}. -* Environment variables:: Environment variables. -* Limitations:: Limitations. -* Problems and requests:: Reports and requests. -* Dependencies:: Dependencies. -* Installing:: Installing. +* Environment variables:: Getting more from @command{ponysay} with environment variables. +* Limitations:: Known limitations that may not be that easy to overcome. +* Problems and requests:: Report issues and making requests. +* Dependencies:: Ponysay's Dependencies. +* Installing:: How to install @command{ponysay}. * Extensions:: Extensions. -* Inner workings:: Inner workings. -* Contributing:: Contributing. +* Inner workings:: Useful information for those whom want to help hack @command{ponysay}. +* Contributing:: Useful information for those whom want to help improve the world. +* Distributing:: Useful information for OS package repository package maintainers. * Change log:: Differences between the version of @command{ponysay}. * Ponysay contributors:: Ponysay contributors. * Ponysay license:: Ponysay license. @@ -77,18 +81,19 @@ Texts. A copy of the license is included in the section entitled @chapter Overview @cindex overview -@command{ponysay} displays an image of a My Little Pony pony saying some text provided -by the user in a terminal, or a quote from the series. It is was wrapper for -@command{cowsay}, but since version 2.1 it reimplementation @command{cowsay}. If message -is not provided, e.g. by piping, it accepts standard input. The pony saying the given -message is printed on standard output. +@command{ponysay} displays an image of a My Little Pony pony saying some text +provided by the user in a terminal, or a quote from the series. It is was wrapper for +@command{cowsay}, but since version 2.1 it reimplementation @command{cowsay}. +If message is not provided, e.g. by piping, it accepts standard input. The pony +saying the given message is printed on standard output. -@command{ponythink} is to @command{ponysay} as @command{cowthink} is to @command{cowsay}. +@command{ponythink} is to @command{ponysay} as @command{cowthink} is to +@command{cowsay}. @command{ponysay} is generally used to decorate your terminal with a random pony, when you start the terminal. But if you known anypony how does like ponies [fat chance] you -can always make screen-shots of @command{ponysay -q} runs and communication that way over -e-mail. +can always make screen-shots of @command{ponysay -q} runs and communication that way +over e-mail. @@ -103,40 +108,40 @@ e-mail. The format for running the @command{ponysay} program is: @example -ponysay [@var{option}@dots{}] [--] [@var{message}] -ponythink [@var{option}@dots{}] [--] [@var{message}] +ponysay [@var{option}...] [--] [@var{message}] +ponythink [@var{option}...y] [--] [@var{message}] @end example -Running @command{ponysay} will print a speech balloon, -@command{ponythink} will print a thought balloon. -Otherwise @command{ponysay} and @command{ponythink} is the same thing. +Running @command{ponysay} will print a speech balloon, @command{ponythink} will +print a thought balloon. Otherwise @command{ponysay} and @command{ponythink} is +the same thing. @command{ponysay} supports the following options: @table @option @item -- -@cindex @command{--} +@cindex @option{--} Parse the following arguments as parts of @code{@var{message}}. @item -h @itemx --help -@cindex @command{-h} -@cindex @command{--help} +@cindex @option{-h} +@cindex @option{--help} Show summary of options. @item -v -@item --verion -@cindex @command{-v} -@cindex @command{--version} +@itemx --verion +@cindex @option{-v} +@cindex @option{--version} Show version of program. @item -f PONY @itemx --file PONY @itemx --pony PONY -@cindex @command{-f} -@cindex @command{--file} -@cindex @command{--pony} +@cindex @option{-f} +@cindex @option{--file} +@cindex @option{--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 specify a set of ponies from which one will be selected randomly. If no pony is @@ -147,57 +152,57 @@ specified one will be selected randomly. @cindex png images @cindex images, png @cindex portable network graphics -If you have @command{util-say} installed, you can use .png-files as the -arguments for this options. +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 pony name +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 pony name supersedes file names. @item -F @itemx ++file PONY @itemx ++pony PONY -@cindex @command{-F} -@cindex @command{++file} -@cindex @command{++pony} -Just as @command{-F}, but it uses extra (non-MLP:FiM) ponies instead of -standard (MLP:FiM) ponies +@cindex @option{-F} +@cindex @option{++file} +@cindex @option{++pony} +Just as @option{-F}, but it uses extra (non-MLP:FiM) ponies instead of standard +(MLP:FiM) ponies @item -b STYLE @itemx --bubble STYLE @itemx --balloon STYLE -@cindex @command{-b} -@cindex @command{--bubble} -@cindex @command{--balloon} +@cindex @option{-b} +@cindex @option{--bubble} +@cindex @option{--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 +balloon name printed by @option{ponysay -B}. This option can be used multiple times to specify a set of styles from which one will be selected randomly. If no balloon style is specified a fallback style will be used. @item -q [PONY...] @itemx --quote [PONY...] -@cindex @command{-q} -@cindex @command{--quote} +@cindex @option{-q} +@cindex @option{--quote} By using this option, a pony will be printed with quotes from her in My Little Pony: Friendship is Magic. The pony will be selected randomly, unless at least one pony -is added as an argument after @command{-q}. If one or more ponies are added after -@command{-q}, the pony will be selected randomly from that set of ponies. -This option requires the extension @command{ponyquotes4ponysay}, which -is included by default since version 1.2. +is added as an argument after @option{-q}. If one or more ponies are added after +@option{-q}, the pony will be selected randomly from that set of ponies. +This option requires the extension @command{ponyquotes4ponysay}, which is included +by default since version 1.2. -The argument can be a file name, but pony if it ends with @code{.pony}. +The argument can be a file name, but pony if it ends with @file{.pony}. @item -W COLUMN @itemx --wrap COLUMN -@cindex @command{-W} -@cindex @command{--wrap} +@cindex @option{-W} +@cindex @option{--wrap} Specify the screen column where the message should be wrapped, this is by default 40, which is inherited from @command{cowsay}. @item -c @itemx --compress -@cindex @command{-c} -@cindex @command{--compress} +@cindex @option{-c} +@cindex @option{--compress} @cindex figlet @cindex toilet Compress the message in the same way @command{cowsay} does, that is basically @@ -207,56 +212,54 @@ messages. @item -l @itemx --list -@cindex @command{-l} -@cindex @command{--list} -Lists all installed ponies. If the extension @command{ponyquotes4ponysay} -is installed the ponies which have quotes, i.e. can be used with the -@command{-q} option, will be mark by being printed in bold or bright -(depending on the terminal.) +@cindex @option{-l} +@cindex @option{--list} +Lists all installed ponies. If the extension @command{ponyquotes4ponysay} is +installed the ponies which have quotes, i.e. can be used with the @option{-q} +option, will be mark by being printed in bold or bright (depending on the terminal.) @item -L @itemx --altlist -@cindex @command{-L} -@cindex @command{--altlist} +@cindex @option{-L} +@cindex @option{--altlist} Lists all installed ponies. If the extension @command{ponyquotes4ponysay} -is installed the ponies which have quotes, i.e. can be used with the -@command{-q} option, will be mark by being printed in bold or bright -(depending on the terminal.) This options differs from @command{-l} by -printing alternative names (symbolic links) inside brackets after their -target ponies. +is installed the ponies which have quotes, i.e. can be used with the @option{-q} +option, will be mark by being printed in bold or bright (depending on the terminal.) +This options differs from @option{-l} by printing alternative names (symbolic links) +inside brackets after their target ponies. @item +l @itemx ++list -@cindex @command{+l} -@cindex @command{++list} -Just as @command{-l}, but it lists extra (non-MLP:FiM) ponies instead of -standard (MLP:FiM) ponies +@cindex @option{+l} +@cindex @option{++list} +Just as @option{-l}, but it lists extra (non-MLP:FiM) ponies instead of standard +(MLP:FiM) ponies @item +L @itemx ++altlist -@cindex @command{+L} -@cindex @command{++altlist} -Just as @command{-L}, but it lists extra (non-MLP:FiM) ponies instead of -standard (MLP:FiM) ponies +@cindex @option{+L} +@cindex @option{++altlist} +Just as @option{-L}, but it lists extra (non-MLP:FiM) ponies instead of standard +(MLP:FiM) ponies @item -B @itemx --balloonlist -@cindex @command{-B} -@cindex @command{--balloonlist} +@cindex @option{-B} +@cindex @option{--balloonlist} Prints a list of all balloon styles. @end table @cindex @var{message} -If neither @command{-q} is used nor any @var{message} is specified, @command{ponysay} -will read the message from stdin (standard input); however, if no arguments -are used that nothing is piped to stdin, a help message will be printed. -If you want to use @command{ponysay} without arguments and enter the message -by hand, you can run @code{cat | ponysay}. +If neither @option{-q} is used nor any @var{message} is specified, @command{ponysay} +will read the message from stdin (standard input); however, if no arguments are used +that nothing is piped to stdin, a help message will be printed. If you want to use +@command{ponysay} without arguments and enter the message by hand, you can run +@code{cat | ponysay}. -@cindex @code{best.pony} -If no pony is selected, @command{ponysay} will look for a @code{best.pony} file, -this should be a symbolic link to the pony you want as a default. If it is not -a symbolic link, @command{-q} cannot determine which quotes to use. +@cindex file{best.pony} +If no pony is selected, @command{ponysay} will look for a @file{best.pony} file, +this should be a symbolic link to the pony you want as a default. If it is not a +symbolic link, @option{-q} cannot determine which quotes to use. @node Advanced usage @@ -276,17 +279,16 @@ a symbolic link, @command{-q} cannot determine which quotes to use. @cindex fortune @cindex startup @cindex on startup -@cindex .bashrc +@cindex @file{.bashrc} If you have @command{fortune} installed -- this program may be named -@command{fortune-mod} in your GNU/Linux distributions package repository -- -you can run @code{fortune | ponysay} to get a random pony reading a -random fortune cookie. +@command{fortune-mod} in your GNU/Linux distributions package repository -- you can +run @code{fortune | ponysay} to get a random pony reading a random fortune cookie. By adding @code{fortune | ponysay} to the end [easiest way] of your -@code{~/.bashrc} -- or equivalent for your shell if you do not use GNU Bash -(standard shell for most distributions now a days) -- you will get the -effect described in the previous paragraph every time you open a terminal. +@file{~/.bashrc} -- or equivalent for your shell if you do not use GNU Bash +(standard shell for most distributions now a days) -- you will get the effect +described in the previous paragraph every time you open a terminal. @node Ponification @@ -310,10 +312,11 @@ script, but I haven't used the script so I wouldn't know for sure. @section Running on TTY @cindex tty @cindex linux vt -@cindex .bashrc +@cindex @file{.bashrc} If you use TTY and have a custom colour palette, you should also add to your -@code{~/.bashrc}, before @code{fortune | ponysay}: +@file{~/.bashrc}, before @code{fortune | ponysay}: +@cartouche @example [ "$TERM" = "linux" ] && function ponysay @@ -321,6 +324,7 @@ If you use TTY and have a custom colour palette, you should also add to your #RESET PALETTE HERE @} @end example +@end cartouche @node Running on screen @@ -330,13 +334,14 @@ If you use TTY and have a custom colour palette, you should also add to your @command{screen} will adapt ANSI colour escape sequences to your terminal's capabilities. This means that if your terminal reports itself as @code{xterm} -in @code{$TERM} ponies will lose their colours; they will only use the lower 16 +in @env{$TERM} ponies will lose their colours; they will only use the lower 16 colours instead of the top 240 colours. By default, almost all X terminals, including @command{xterm} and @command{mate-terminal} reports themselves as -@code{xterm} in @code{$TERM}, and some reports their actual name in @code{$COLORTERM}. -So before opening @command{screen} you use set @code{$TERM} to @code{xterm-256color}, +@code{xterm} in @env{$TERM}, and some reports their actual name in @env{$COLORTERM}. +So before opening @command{screen} you use set @env{$TERM} to @code{xterm-256color}, if you are using a terminal with support for @code{xterm}'s 256 colours; this -can be done by adding to your @code{~/.bashrc}: +can be done by adding to your @file{~/.bashrc}: +@cartouche @example [ "$TERM" = "xterm" ] && function screen @@ -344,6 +349,7 @@ can be done by adding to your @code{~/.bashrc}: exec screen "$@@" @} @end example +@end cartouche @@ -354,46 +360,46 @@ can be done by adding to your @code{~/.bashrc}: @command{ponysay} supports the follow environment variables: -@table @option +@table @env @item PONYSAY_BOTTOM -@cindex PONYSAY_BOTTOM +@cindex @env{PONYSAY_BOTTOM} @cindex tty Under TTY (Linux VT), if the output is larger the the screen's height, only the beginning is printed, leaving two blank lines. If you want the bottom -to be printed rather the the beginning you can export @code{PONYSAY_BOTTOM} +to be printed rather the the beginning you can export @env{PONYSAY_BOTTOM} with the value @code{yes}, @code{y} or @code{1}. @item PONYSAY_SHELL_LINES -@cindex PONYSAY_SHELL_LINES +@cindex @env{PONYSAY_SHELL_LINES} @cindex tty Under TTY (Linux VT), if the output is larger the the screen's height, two lines are left blank. If you want more, or less, blank lines you can export -@code{PONYSAY_SHELL_LINES} with the value of how many blank lines you want. +@env{PONYSAY_SHELL_LINES} with the value of how many blank lines you want. Naturally this takes effect if the output is not actually larger than the screen. @item PONYSAY_FULL_WIDTH -@cindex PONYSAY_FULL_WIDTH -You can export @code{PONYSAY_FULL_WIDTH} with the value @code{yes}, @code{y} +@cindex @env{PONYSAY_FULL_WIDTH} +You can export @env{PONYSAY_FULL_WIDTH} with the value @code{yes}, @code{y} or @code{1}, if you do not want the output to be truncated on the width to fit the terminal. @item PONYSAY_TRUNCATE_HEIGHT -@cindex PONYSAY_TRUNCATE_HEIGHT -Export @code{PONYSAY_TRUNCATE_HEIGHT} with the value @code{yes}, @code{y} +@cindex @env{PONYSAY_TRUNCATE_HEIGHT} +Export @env{PONYSAY_TRUNCATE_HEIGHT} with the value @code{yes}, @code{y} or @code{1}, if you want to truncate the output on the height even if you are not running @command{ponysay} under TTY. @item PONYSAY_UCS_ME -@cindex PONYSAY_UCS_ME +@cindex @env{PONYSAY_UCS_ME} @cindex ucs @cindex universal character set @cindex unicode @cindex ascii -Export @code{PONYSAY_UCS_ME} with the value @code{yes}, @code{y} or @code{1}, +Export @env{PONYSAY_UCS_ME} with the value @code{yes}, @code{y} or @code{1}, if you want [simulated] symlink to pony files using Universal Character Set in their names. Otherwise pony files uses only ASCII. If you want to remove -the ASCII:ised names export @code{PONYSAY_UCS_ME} with the value @code{harder}, +the ASCII:ised names export @env{PONYSAY_UCS_ME} with the value @code{harder}, @code{h} or @code{2} instead. If you have not enabled this, UCS names are not usable, suggested or listed. @@ -403,8 +409,8 @@ will still be usable. @item PONYSAY_COWSAY @itemx PONYSAY_COWTHINK -@cindex PONYSAY_COWSAY -@cindex PONYSAY_COWTHINK +@cindex @env{PONYSAY_COWSAY} +@cindex @env{PONYSAY_COWTHINK} @cindex custom cowsay @cindex replace cowsay Since version 2.1 this is no longer used as @command{cowsay} has been @@ -412,13 +418,13 @@ reimplemented inside @command{ponysay}, but it is possible we will add a way to replace that back-end. If you want to use another program than @command{cowsay} (the first -@command{cowsay} found in @code{$PATH}), you can export @code{PONYSAY_COWSAY} +@command{cowsay} found in @env{$PATH}), you can export @env{PONYSAY_COWSAY} with the value of that program. In earlier versions than version 2.0: If, and -only if, @code{PONYSAY_COWSAY} does not have any value, @command{cowsay} is +only if, @env{PONYSAY_COWSAY} does not have any value, @command{cowsay} is patch with @code{use utf8;} to the beginning. The @code{use utf8;} patch is introduced to make it easier to customise cowsay. -@code{PONYSAY_COWTHINK} will be used instead of @code{PONYSAY_COWSAY} if +@env{PONYSAY_COWTHINK} will be used instead of @env{PONYSAY_COWSAY} if you run @command{ponythink}. @end table @@ -461,10 +467,10 @@ is because if your graphics driver supports KMS, the colours will be messed by w ponies position moves on the screen, this is also reason why the output is truncated on the height in TTY by default. -Most terminals have support for 256 colours, we do however only use the top 240 colours; -this is because the lower 16 colours are usually, in contrast to the top 240, customised. -We assume that the top 240 colours have their standard values. In TTY with KMS support -we dot have any actual (except for @math{2^{24}} + full transparency.) +Most terminals have support for 256 colours, we do however only use the top 240 +colours; this is because the lower 16 colours are usually, in contrast to the top 240, +customised. We assume that the top 240 colours have their standard values. In TTY with +KMS support we dot have any actual (except for @math{2^{24}} + full transparency.) @cindex xterm @cindex urxvt @@ -473,10 +479,10 @@ we dot have any actual (except for @math{2^{24}} + full transparency.) @cindex mrxvt @cindex Eterm @cindex aterm -@command{ponysay} works perfectly on @command{xterm}, @command{urxvt} and @command{putty}, -but @command{rxvt}, @command{mrxvt} and @command{Eterm} do not have UTF-8 support and are -currently not supported. Additionally @command{aterm} have neither UTF-8 support nor 256 -colour support, and is therefore not yet support. +@command{ponysay} works perfectly on @command{xterm}, @command{urxvt} and +@command{putty}, but @command{rxvt}, @command{mrxvt} and @command{Eterm} do not +have UTF-8 support and are currently not supported. Additionally @command{aterm} +have neither UTF-8 support nor 256 colour support, and is therefore not yet support. @cindex 9term Due to extreme limitations in @command{9term} @command{ponysay} will never be able to @@ -499,12 +505,12 @@ colours and text styling in messages will also malformat the balloon with the me @command{cowsay} does not support balloon, including the link between the message and the pony, customisation, other than using @command{cowthink}. However you can modify -@command{cowsay} (written Perl, so you can edit the installed files) to make the balloon -look different, maybe using box drawing characters. +@command{cowsay} (written Perl, so you can edit the installed files) to make the +balloon look different, maybe using box drawing characters. -@command{cowsay} does not support setting the minimum size of the balloon, both directions -on the balloon–pony links. or any other placement of the balloon than at the top to -the left. +@command{cowsay} does not support setting the minimum size of the balloon, both +directions on the balloon–pony links. or any other placement of the balloon than at +the top to the left. @@ -532,10 +538,10 @@ solve it faster. @section Requesting ponies @cindex pony requests -If you want I specific pony added, ask us at @url{https://github.com/erkin/ponysay/issues} -and we will add it. To speed the up the process, if possible, supply good -pictures. Full visibly, transparent background, and pixelated are the -properties that makes a picture good. +If you want I specific pony added, ask us at +@url{https://github.com/erkin/ponysay/issues} and we will add it. +To speed the up the process, if possible, supply good pictures. Full visibly, +transparent background, and pixelated are the properties that makes a picture good. @@ -555,10 +561,10 @@ properties that makes a picture good. @node Required runtime dependencies @section Required runtime dependencies -@table @option +@table @command @item coreutils @command{stty} is used to determine the size of the terminal. -@item python +@item python>=3 @command{ponysay} is written in pure Python 3. @end table @@ -567,7 +573,7 @@ properties that makes a picture good. @cindex extensions @cindex optional dependencies -@table @option +@table @command @item util-say>=2 @cindex @command{util-say} @cindex kms @@ -580,28 +586,29 @@ It can be downloaded at @url{https://github.com/maandree/util-say}. @cindex png images @cindex images, png @cindex portable network graphics -For the purpose of simplifying for pony contributors, @command{ponysay} -supports using .png-images (note that the file must not miss the -@code{.png} in the file) in addition of .pony-files or pony names. +For the purpose of simplifying for pony contributors, @command{ponysay} supports +using .png-images (note that the file must not miss the @file{.png} in the file) +in addition of .pony-files or pony names. @end table @node Package building dependencies @section Package building dependencies -@table @option +@table @command @item gzip Used for compressing manuals. @item texinfo @itemx info -@command{texinfo} and @command{info} are required if you want this @command{info} manual. +@command{texinfo} and @command{info} are required if you want this @command{info} +manual. @item make Required to run the make script. @item coreutils The make script uses @command{install}, @command{unlink}, @command{rm}, @command{ln}, @command{mkdir} and @command{cp} and @command{cut}. @item sed -Used by the make script for @command{PREFIX} customisation. +Used by the make script for @option{PREFIX} customisation. @end table @@ -609,9 +616,9 @@ Used by the make script for @command{PREFIX} customisation. @section Dependencies for pony providers @cindex contributing -@table @option +@table @command @item make -Required to run @command{make -B ttyponies`}. +Required to run @command{make -B ttyponies}. @item coreutils @command{ln} and @command{readlink} are used in the @command{ttyponies} subscript. @item bash @@ -648,22 +655,23 @@ It can be downloaded at @url{https://github.com/maandree/util-say}. @node Installations basics @subsection Installations basics -@cindex make +@cindex @command{make} @cindex basic installation -Before installing @command{ponysay}, make sure your system have the packages listed under -@ref{Required runtime dependencies} and @ref{Package building dependencies} installed. +Before installing @command{ponysay}, make sure your system have the packages listed +under @ref{Required runtime dependencies} and @ref{Package building dependencies} +installed. Tarballs can be downloaded at @url{https://github.com/erkin/ponysay/tarball/master} for bleeding edge, or from @url{https://github.com/erkin/ponysay/tags} for releases. -If you have @command{git} you @command{clone} the project URL +If you have @command{git} you can @command{clone} the project URL @url{https://github.com/erkin/ponysay.git}. In the terminal, @command{cd} into the ponysay directory and execute @command{./configure && make install}. This will install @command{ponysay} into the -@code{/usr}, meaning you may need to run @command{make install} as root, +@file{/usr}, meaning you may need to run @command{make install} as root, e.g. by running @command{sudo make install}. Now you will be to use ponysay, run: @command{ponysay "I am just the cutest pony!"}, @@ -673,7 +681,7 @@ or if have a specific pony in your mind: @command{ponysay -f pinkie "Partay!~"}. @command{ponysay} comes with this @command{info} manual and a manpage in section 6, @command{man 6 ponysay} (or just @command{man ponysay}). The manpage is also available in Spanish: @command{man -L es 6 ponysay}. The install the Spanish manual add the -option @command{--with-man-es} when running @command{./configure}. +option @option{--with-man-es} when running @command{./configure}. @node Custom installations @@ -684,62 +692,62 @@ option @command{--with-man-es} when running @command{./configure}. @cindex @command{./configure} @cindex configure -@cindex @command{--everything} +@cindex @option{--everything} A basic installation will install everything @command{ponysay} has to offer, except the prebuilt PDF manual and translated manpages. If you want to install exactly -everything add the option @command{--everything} when running @command{./configure}. +everything add the option @option{--everything} when running @command{./configure}. -@cindex @command{--with-pdf} +@cindex @option{--with-pdf} @cindex PDF manual, with -@cindex @command{--without-man} +@cindex @option{--without-man} @cindex manpage, without -@cindex @command{--without-info} -@cindex @command{--without-info-install} -@cindex @command{info} manual, without -@cindex @command{--with-man-LANG} +@cindex @option{--without-info} +@cindex @option{--without-info-install} +@cindex @option{info} manual, without +@cindex @option{--with-man-LANG} @cindex manpage translations -After @command{--everything} it is possible to remove unwanted parts, this can -of cause be done without @command{--everything}. If you want to install the -PDF manual to @code{/usr/doc/ponysay.pdf} add the option @command{--with-pdf} when -running @command{./configure}. To install a manpage translation add -@command{--with-man-LANG} and substitute the the language code for @code{LANG}. -Currently the only translation is Spanish with the language code @code{es}. -If you do not want the English manpage add the option @command{--without-man}. -If you do not want the @command{info} manual add the option @command{--without-info}. -If you are installing the @command{info} manual but are not privileged to execute -@command{install-info} add the option @command{--without-info-install}. +After @option{--everything} it is possible to remove unwanted parts, this can of +cause be done without @option{--everything}. If you want to install the PDF manual +to @file{/usr/doc/ponysay.pdf} add the option @option{--with-pdf} when running +@command{./configure}. To install a manpage translation add @option{--with-man-LANG} +and substitute the the language code for @code{LANG}. Currently the only translation +is Spanish with the language code @code{es}. If you do not want the English manpage +add the option @option{--without-man}. If you do not want the @command{info} manual +add the option @option{--without-info}. If you are installing the @command{info} +manual but are not privileged to execute @command{install-info} add the option +@option{--without-info-install}. The following argumentless options are also recognised: @itemize @bullet -@item @command{--without-bash} -@cindex @command{--without-bash} +@item @option{--without-bash} +@cindex @option{--without-bash} @cindex @command{bash}, without will skip installation of auto-completion for @command{ponysay} and the GNU Bourne-again shell, @command{bash}. -@item @command{--without-fish} -@cindex @command{--without-fish} +@item @option{--without-fish} +@cindex @option{--without-fish} @cindex @command{fish}, without will skip installation of auto-completion for @command{ponysay} and the Friendly interactive shell, @command{fish}. -@item @command{--without-zsh} -@cindex @command{--without-zsh} +@item @option{--without-zsh} +@cindex @option{--without-zsh} @cindex @command{zsh}, without will skip installation of auto-completion for @command{ponysay} and the shell @command{zsh}. -@item @command{--without-shared-cache} -@cindex @command{--without-shared-cache} +@item @option{--without-shared-cache} +@cindex @option{--without-shared-cache} @cindex cache @cindex kms will skip installing a shared cache for KMS support, when there is no -shared cache, private one will be used at @code{~/.cache/ponysay}. +shared cache, private one will be used at @file{~/.cache/ponysay}. @end itemize -@cindex @command{--prefix=TARGET} -@cindex @code{/usr/games} -The program is by default installed in @code{/usr}, if you want another target -directory, you can add @command{--prefix=TARGET} when running @command{./configure}. -For example to install @command{ponysay} in @code{/usr/games} you build the +@cindex @option{--prefix=TARGET} +@cindex @file{/usr/games} +The program is by default installed in @file{/usr}, if you want another target +directory, you can add @option{--prefix=TARGET} when running @command{./configure}. +For example to install @command{ponysay} in @file{/usr/games} you build the program by running @command{./configure --prefix=/usr/games}, and alike for installation and uninstallation. Notice the @command{=} cannot be substituted with white space. @@ -760,7 +768,7 @@ add the option @command{--shell=SHELL}. @cindex arch linux The official Arch Linux package repositories contains @command{ponysay} as -@code{community/ponysay}. The Arch Linux User Repository (AUR) contains a bleeding +@w{@code{community/ponysay}}. The Arch Linux User Repository (AUR) contains a bleeding edge git version of @command{ponysay} as @code{ponysay-git}. @@ -790,7 +798,7 @@ manually from the upstream, you can uninstall it by running @command{make uninst Well written package manages will uninstall files that the package is no longer using, i.e. if deleted, moved or renamed. To uninstall files that are not longer -used, by the currently installed version you will need that versions @code{Makefile}. +used, by the currently installed version you will need that versions @file{Makefile}. To perform the uninstallation of old filed run @command{make uninstall-old}. @@ -804,8 +812,8 @@ Ponysay does not support extensions, per se, but rather have optional features t are enabled when other packages are installed. @menu -* ponyquotes4ponysay:: ponyquotes4ponysay: Quotes from My Little Ponies. -* kmsponies4ponysay:: kmsponies4ponysay: Improved TTY support under KMS support. +* ponyquotes4ponysay:: ponyquotes4ponysay: Quotes from My Little Ponies. +* kmsponies4ponysay:: kmsponies4ponysay: Improved TTY support under KMS support. @end menu @@ -829,37 +837,41 @@ but is still available at @url{https://github.com/maandree/ponyquotes4ponysay}. @cindex kms @cindex kernel mode settings @cindex environment variables -@cindex PONYSAY_KMS_PALETTE -@cindex PONYSAY_KMS_PALETTE_CMD -@cindex .bashrc - -@command{kmsponies4ponysay} is an extension for TTY users that have a custom TTY colour -palette and KMS support. KMS is supported on most computers, but due to lack of published -specifications Nvidea drivers does not support KMS. @command{kmsponies4ponysay} can be -downloaded at @url{https://github.com/maandree/kmsponies4ponysay}. - -To use this extension your @code{~/.bashrc} (or equivalent for your shell) must keep track -of your colour palette, it is not possible for a program to ask to terminal. Either the -shell should export a palette string to @code{$PONYSAY_KMS_PALETTE} or you should export -a command to can get the palette string to @code{$PONYSAY_KMS_PALETTE_CMD}. The palette -string should be the stream which sets the colour palette to the terminal when -@command{echo}:ed; preferably, to increase speed and reduce cache usage, it should be -consistent every time it is exported for every colours palette. So you may want to keep it -sorted, always be in either upper case or lower case, and not contain an character that -is not used to set the colour palette. - -Assuming you have a function in your @code{~/.bashrc}, to reset the colour palette to what -you set it to last time in the terminal, named @command{reset-palette}, your @code{~/.bashrc} -should, for example, contain: +@cindex @env{PONYSAY_KMS_PALETTE} +@cindex @env{PONYSAY_KMS_PALETTE_CMD} +@cindex @file{.bashrc} + +@command{kmsponies4ponysay} is an extension for TTY users that have a custom TTY +colour palette and KMS support. KMS is supported on most computers, but due to lack +of published specifications Nvidea drivers does not support KMS. +@command{kmsponies4ponysay} can be downloaded at +@url{https://github.com/maandree/kmsponies4ponysay}. + +To use this extension your @file{~/.bashrc} (or equivalent for your shell) must keep +track of your colour palette, it is not possible for a program to ask to terminal. +Either the shell should export a palette string to @env{$PONYSAY_KMS_PALETTE} or you +should export a command to can get the palette string to +@env{$PONYSAY_KMS_PALETTE_CMD}. The palette string should be the stream which sets +the colour palette to the terminal when @command{echo}:ed; preferably, to increase +speed and reduce cache usage, it should be consistent every time it is exported for +every colours palette. So you may want to keep it sorted, always be in either upper +case or lower case, and not contain an character that is not used to set the colour +palette. + +Assuming you have a function in your @file{~/.bashrc}, to reset the colour palette +to what you set it to last time in the terminal, named @command{reset-palette}, +your @file{~/.bashrc} should, for example, contain: +@cartouche @example [ "$TERM" = "linux" ] && function ponysay - @{ export PONYSAY_KMS_PALETTE="`reset-palette`" + @{ export PONYSAY_KMS_PALETTE="$(reset-palette)" exec ponysay "$@@" @} @end example +@end cartouche -@command{kmsponies4ponysay} uses @code{/var/cache/kmsponies4ponysay/} for cache space. +@command{kmsponies4ponysay} uses @file{/var/cache/kmsponies4ponysay/} for cache space. As of version 2.0 @command{kmsponies4ponysay} is included in @command{ponysay}, but is still available at @url{https://github.com/maandree/kmsponies4ponysay}. @@ -910,10 +922,11 @@ whether @code{X} is the minimum width of the balloon and @code{Y} is the minimum height of the balloon. Prior to version 2.1 the pony files were cow files used by @command{cowsay}, they -are partial Perl-scripts that assign a value to a scalar variable named @code{$the_cow}. -Cow files use a predefined scalar variable named @code{$thoughts}, these are used -to create a link between the message and the pony. The message (and the balloon) -itself was printed by @command{cowsay} and is not defined in the cow files. +are partial Perl-scripts that assign a value to a scalar variable named +@var{$the_cow}. Cow files use a predefined scalar variable named @code{$thoughts}, +these are used to create a link between the message and the pony. The message (and +the balloon) itself was printed by @command{cowsay} and is not defined in the cow +files. @node Pony quote infrastructure @@ -921,19 +934,19 @@ itself was printed by @command{cowsay} and is not defined in the cow files. @cindex pony quote infrastructure @cindex quote infrastructure -When compiles pony quotes are built to @code{quotes}, the file names are lists of -ponies joined with plus signs (@code{+}) -- the pony names are the same as the pony files, -except they do not end with @code{.pony} -- with a index at the end, and a full stop -(@code{.}) before the index. +When compiles pony quotes are built to @file{quotes/}, the file names are lists of +ponies joined with plus signs (@code{+}) -- the pony names are the same as the pony +files, except they do not end with @file{.pony} -- with a index at the end, and a +full stop (@code{.}) before the index. -The source files are located in @code{ponyquotes}, where their is a file named @code{ponies}. -This file is called the pony map, is the basis for how the compiled files are named. -In the ponymap ponies with the same quotes are on the same line join togather with plus -signs (@code{+}), if the lines because too long for file names the line is split into -multiple lines with the first pony in common. +The source files are located in @file{ponyquotes/}, where their is a file named +@file{ponies}. This file is called the pony map, is the basis for how the compiled +files are named. In the ponymap ponies with the same quotes are on the same line +join togather with plus signs (@code{+}), if the lines because too long for file +names the line is split into multiple lines with the first pony in common. -In @code{ponyquotes} there are also quote files, each contain just one quote, just as -when compiled to @code{quotes}. The source quote files are indentical to the compiled +In @file{ponyquotes/} there are also quote files, each contain just one quote, just as +when compiled to @file{quotes/}. The source quote files are indentical to the compiled quote files, except that there name contains just the first pony. @@ -943,18 +956,18 @@ quote files, except that there name contains just the first pony. @cindex bubble style files @cindex ponythink -Balloon style files are located in the directory @code{balloons}, the ones ending with -@code{.say} applies to @command{ponysay} and the ones ending with @code{.think} applies -to @command{ponythink}. +Balloon style files are located in the directory @file{balloons/}, the ones ending +with @file{.say} applies to @command{ponysay} and the ones ending with @file{.think} +applies to @command{ponythink}. -Balloon style consists of 20 strings. Each string is definied on separate lines, by their -name and their value seperated with a colon (@code{name:value}), if the name is empty it -continues the last one new line in the value. Only 10 of the strings may be multilined: -@code{nw}, @code{nnw}, @code{n}, @code{nne}, @code{ne}, @code{sw}, @code{ssw}, @code{s} -@code{sse} and @code{se}. +Balloon style consists of 20 strings. Each string is definied on separate lines, by +their name and their value seperated with a colon (@code{name:value}), if the name is +empty it continues the last one new line in the value. Only 10 of the strings may be +multi-lined: @var{nw}, @var{nnw}, @var{n}, @var{nne}, @var{ne}, @var{sw}, @var{ssw}, +@var{s}, @var{sse} and @var{se}. The following strings are used, and must be definied in the files: -@table @option +@table @var @item \ The character for the link to the balloon directed as @code{\}. @item / @@ -968,13 +981,13 @@ contains only one line. @item nw The top left corner of the balloon. @item nnw -If both this string and the @code{'nne'} string fits between the top corners, this -is printed directly to the right of the top left corner. +If both this string and the @var{nne} string fits between the top corners, this is +printed directly to the right of the top left corner. @item n The top edge of the balloon. @item nne -If both this string and the @code{'nnw'} string fits between the top corners, this -is printed directly to the right of the top top corner. +If both this string and the @var{nnw} string fits between the top corners, this is +printed directly to the right of the top top corner. @item ne The top right corner of the balloon. @item nee @@ -988,12 +1001,12 @@ if the message contains more than one line. @item se The bottom right corner of the balloon. @item sse -If both this string and the @code{'ssw'} string fits between the bottom corners, this +If both this string and the @var{ssw} string fits between the bottom corners, this is printed directly to the left of the bottom right corner. @item s The bottom edge of the balloon. @item ssw -If both this string and the @code{'sse'} string fits between the bottom corners, this +If both this string and the @var{sse} string fits between the bottom corners, this is printed directly to the right of the bottom left corner. @item sw The bottom left corner of the balloon. @@ -1016,14 +1029,15 @@ only if the message contains more than one line. @cindex kms @cindex kernel mode settings -Since Linux VT (TTY) does not have capabilities for returning the position of the cursor, -the screen must always be cleared before printing the ponies to make sure the pony's -colours is not lost, i.e. reduced to mare 16 colours, during print. The colours are reduced -if the pony's position on the screen is changed. This is only relevant with KMS support. -The clear the screen we print ``@code{\e[H\e[2J}'' (@code{\e} is ESC) in at beginning. -``@code{\e[H}'' places the cursor at the beginning of the screen, and ``@code{\e[2J}'' clears -everything on the screen after, and including at, the cursor. If we would use ``@code{\ec}'' -(that is a reset), we would also turn off num. lock and caps. lock. +Since Linux VT (TTY) does not have capabilities for returning the position of the +cursor, the screen must always be cleared before printing the ponies to make sure +the pony's colours is not lost, i.e. reduced to mare 16 colours, during print. The +colours are reduced if the pony's position on the screen is changed. This is only +relevant with KMS support. The clear the screen we print ``@code{\e[H\e[2J}'' +(@code{\e} is ESC) in at beginning. ``@code{\e[H}'' places the cursor at the +beginning of the screen, and ``@code{\e[2J}'' clears everything on the screen after, +and including at, the cursor. If we would use ``@code{\ec}'' (that is a reset), +we would also turn off num. lock and caps. lock. @node Truncation @@ -1040,25 +1054,28 @@ by default. Truncating the height in TTY is required under Kernel Mode Settings (KMS) support to keep the colours from being messed up ad the ponies is moved in the screen during -print; this done either by piping to @command{head} (keeps the top) or by piping to -@command{tail} (keeps the bottom.) @command{head} and @command{tail} takes as argument -the number of lines to keep at most. +print. Prior to version 2.0 this was done either by piping to @command{head} (keeps +the top) or by piping to @command{tail} (keeps the bottom.) @command{head} and +@command{tail} takes as argument the number of lines to keep at most. The size of the terminal, measured in characters, is fetched from @command{stty size}, which returns @code{HEIGHT WIDTH}, and @command{cut} it the used to get either the -height or the width. This required on GNU Coreutils; earlier @command{tput rows} and +height or the width. This requires only GNU Coreutils; earlier @command{tput rows} and @command{tput cols} were used, this however required, the only de facto standard, package @command{ncurses}, some shells have environment variables for this. -For truncation the width, we have a custom program, named @command{ponysaytruncater}, -that is installed to @code{/usr/lib/ponysay/truncater}. It recognised UTF-8 ANSI escape -sequences, including OSI P and CSI m, which is essential for the truncation to be correct. -It also expands tabs to every eighth column and resets the background colour when needed, -and writes ANSI escape sequences that are on the left side of the truncation. The truncater -stops CSI sequences on the first ASCII letter (@code{[a-zA-Z]}), but also stops escape -sequences after the first character after the initial escape if it is not either @code{[} -(CSI) or @code{]} (OSI). For support UTF-8, to handles all bytes that do not match -@code{10xxxxxx} as beginning of a character. +Since version 2.1 trunction is done internally in the Python script, before that it +was done in a custom C porgram @command{truncater}, that was installed to +@file{/usr/lib/ponysay/truncater}. It recognised UTF-8 ANSI escape sequences, +including OSI P and CSI m, which is essential for the truncation to be correct. It +also expands tabs to every eighth column and resets the background colour when needed, +and writes ANSI escape sequences that are on the left side of the truncation. The +truncater stops CSI sequences on the first ASCII letter (@code{[a-zA-Z]}), but also +stops escape sequences after the first character after the initial escape if it is +not either @code{[} (CSI) or @code{]} (OSI). In the previus, C, program it supported +UTF-8 by assumming that bytes do not match @code{10xxxxxx} and only those bytes were +visible. This now fixed internally in Python, but has also been improved to exclude +combining characters from the set of visible characters. @node Languages @@ -1067,15 +1084,15 @@ sequences after the first character after the initial escape if it is not either @cindex script languages @cindex programming languages -Before version 2.0 @command{ponysay} was written primarily in GNU Bash script -(POSIX compliant); the truncater was however written in C, because it is simple, -fast, does not pose addition dependencies, and is easy to do byte hacking in. +Before version 2.0 @command{ponysay} was written primarily in GNU Bash script (POSIX +compliant); the truncater was however written in C, because it is simple, fast, does +not pose addition dependencies, and is easy to do byte hacking in. -Sometimes shell is too slow, in these cases Perl was used; Perl was already -required by cowsay, is similar to shell, but also supports hash tables. +Sometimes shell is too slow, in these cases Perl was used; Perl was already required +by @command{cowsay}, is similar to shell, but also supports hash tables. -However since version 2.0 we were trying to move from all there languages -and only use Python 3, which as been accomplished in version 2.1. +However since version 2.0 we were trying to move from all there languages and only +use Python 3, which as been accomplished in version 2.1. @node Shell auto-completion @@ -1087,8 +1104,8 @@ and only use Python 3, which as been accomplished in version 2.1. @cindex @command{--quoters} To make it easier to write auto-completion for shells, @command{ponysay} supports -the two options @command{--onelist}, @command{++onelist} and @command{--quoters}, -which has nt short versions. +the two options @option{--onelist}, @option{++onelist} and @option{--quoters}, +which has no short versions. Executing @command{ponysay --onelist} will list every available standard (MLP:FiM) pony, independent of where it is located, the output is a sorted and consists only @@ -1113,20 +1130,21 @@ Auto-completion scripts should not suggest these options. @cindex pony names In earlier versions of @command{ponysay} only the output truncationed supported -Universal Character Set, though handcoded UTF-8 character counting. Now @command{ponysay} -lets Python decode the data, Python store all 31 bits of a character in as one -character, not in UTF-16 as some other languages does, this means that the code -is agnostic to the chararacter encoding. However in Unicode 6.1 their are four ranges -of combining characters, these do not take up any width in proper terminal, we -their for have a class in the code named @code{UCS} that help us take them into -consideration when determine the length of strings. +Universal Character Set, though handcoded UTF-8 character counting. Now +@command{ponysay} lets Python decode the data, Python store all 31 bits of a +character in as one character, not in UTF-16 as some other languages does, this +means that the code is agnostic to the chararacter encoding. However in Unicode +6.1 their are four ranges of combining characters, these do not take up any +width in proper terminal, we their for have a class in the code named @code{UCS} +that help us take them into consideration when determine the length of strings. Some ponies have names contains non-ASCII characters, read about it in -@ref{Environment variables}. The UCS names are stored in the file @code{share/ucsmap}, -in it lines that are not empty and does not start with a hash (@code{#}) are parse, and -contains a UCS name and a ASCII:ised name. The UCS name comes first, followed by the -ASCII:ised name that it should replace or link to. The two names are separated by and -simple left to right arrow character [U+2192], optionally with surrounding white space. +@ref{Environment variables}. The UCS names are stored in the file @file{share/ucsmap}, +in it lines that are not empty and does not start with a hash (@code{#}) are +parse, and contains a UCS name and a ASCII:ised name. The UCS name comes first, +followed by the ASCII:ised name that it should replace or link to. The two names +are separated by and simple left to right arrow character [U+2192], optionally +with surrounding white space. @@ -1147,10 +1165,11 @@ desktop ponies, implementing it in JavaScript. Browser ponies are available at @url{https://github.com/panzi/Browser-Ponies}. Desktop ponies are available at @url{http://desktop-pony-team.deviantart.com/}. -There is also a collection of ponies that are not yet pixelated in a Java reimplementation: +There is also a collection of ponies that are not yet pixelated in a Java +reimplementation of the early Ponysay: @url{https://github.com/maandree/unisay/tree/develop/dev/newponies} -There is a checklist named @code{"pony-checklist"} at the @code{"dev/"} directory. +There is a checklist named @file{pony-checklist} at the @file{dev/} directory. You can use the check which ponies are added and which are not. @* @@ -1166,18 +1185,20 @@ aspect,) and same width on all rows. Using util-say: @cindex util-say -@cindex img2ponysay +@cindex @command{img2ponysay} +@cartouche @example -img2ponysay -2 -- SOURCE_IMAGE > PONY_FILE +@code{img2ponysay -2 -- SOURCE_IMAGE > PONY_FILE} -PONY_FILE should end with .pony and be localed in ponies/, -or extraponies/ if the pony is not a MLP:FiM pony. +@code{PONY}_FILE should end with @file{.pony} and be localed in @file{ponies/}, +or @file{extraponies/} if the pony is not a MLP:FiM pony. -Omit -2 if the source image does not use double pixel size. +Omit @option{-2} if the source image does not use double pixel size. For more information see: @url{https://github.com/maandree/util-say/wiki/img2ponysay} @end example +@end cartouche @* @cindex util-say @@ -1185,54 +1206,82 @@ For more information see: @cindex png images @cindex images, png @cindex portable network graphics -If you have util-say installed, which is required to build ponies, you can run @code{.png} -files as argument for @command{ponysay -f}, this required that the file is named @code{.png} -at the end. +If you have util-say installed, which is required to build ponies, you can run +PNG files as argument for @command{ponysay -f}, this required that the file is +named @file{.png} at the end. @cindex palette @cindex xterm palette @cindex pony palette @cindex colour palette -The following @code{bash} code will print the palette the ponies (the terminals) use. +The following @command{bash} code will print the palette the ponies (the terminals) +use: +@cartouche @example c=16 while ((c < 256)); do - echo -en "\e[48;5;${c}m \e[49m" + echo -en "\e[48;5;$@{c@}m \e[49m" c=$(( $c + 1 )) if (( $(( c % 36 )) == 16 )); then echo fi done; echo @end example +@end cartouche @* For the palette to be correct, which is especially important when you draw ponies, you must not redefine the colours in the range 16 to 255 (inclusive). @cindex ttypony -When a pony is added please also add a ttypony version, i.e. the pony files used in TTY, -but if you don't please state so in the pull request so we do not miss the create it; -the simplest way to do this is to run @command{make -B ttyponies} after adding the ponies -to @code{ponies/}, running @command{make -B ttyponies} will build (or rebuild) all -ttyponies with a pony present in @code{ponies/}, and creates all needed symlinks. +When a pony is added please also add a ttypony version, i.e. the pony files used in +TTY, but if you don't please state so in the pull request so we do not miss the +create it; the simplest way to do this is to run @command{make -B ttyponies} after +adding the ponies to @file{ponies/}, running @command{make -B ttyponies} will build +(or rebuild) all ttyponies with a pony present in @file{ponies/}, and creates all +needed symlinks. To be able to run @command{make -B ttyponies} you must have the packages listed under @ref{Dependencies for pony providers}. @cindex ponyquotes @cindex quotes -Also when adding new ponies, please map them up in the file @code{"ponyquotes/ponies"}. +Also when adding new ponies, please map them up in the file @file{ponyquotes/ponies}. If the pony is a new pony without any other alternative image just add it to a new -line, without @code{.pony}, preferably in its alphabetical position. +line, without @file{.pony}, preferably in its alphabetical position. If the file is a symlink add it to the same line as the target pony, and if the pony has and alternative image add it the the same line as that pony. Ponies on the same line are separated with a plus sign (@code{+}) without any white space. When a line is too long for a file name (this has happened to Pinkie Pie -[@code{pinkie}],) it must be split into multiple lines, this line should have their +[@file{pinkie}],) it must be split into multiple lines, this line should have their first pony file in common. +@node Distributing +@chapter Distributing +@cindex distributing ponysay +@cindex package maintaining +@cindex OS package maintaining +@cindex maintaining OS package +@cindex fhs +@cindex filesystem hierarchy standard + +If you are planning on maintaining @command{ponysay} in your favourite Operating +System you should first read @ref{Required runtime dependencies} and +@ref{Optional runtime dependencies}. If your OS does not follow Filesystem Hierarchy +Standard (FHS), e.g. installing amusement binaries in @file{/usr/games} instread of +@file{/usr/bin} or only supporting @file{/opt} equivalent directories you should +read about configurations in @ref{Custom installations}. + +Apart from this, you should configure @command{ponysay} before building it with the +option @option{--everything}. Otherwise only the @command{info} manual and the +English manpage will be installed for documentation. + +Please inform us about your distribution so we can list it, everypony can see it. + + + @node Change log @appendix Change log @cindex change log @@ -1243,9 +1292,9 @@ first pony file in common. @itemize @bullet @item -Support for @code{best.pony} file. +Support for @file{best.pony} file. @item -@code{-q} accepts file names. +@option{-q} accepts file names. @item Improved Unicode support: treats combining characters as invisible. @item @@ -1258,14 +1307,14 @@ Support cowsay style message compression. @item Pony symlink added: @itemize @bullet -@item @code{pinkieoink} → @code{oinkoinkoink} +@item @file{pinkieoink} → @file{oinkoinkoink} @end itemize @item Support for non-MLP:FiM ponies (known as extraponies), although the directory is currently empty. @c BEGIN the following is too descriptive for the plain/text change log -This is implemented with the options @code{-F}, @code{+l}, and @code{+L} -corresponding to @code{-f}, @code{-l}, and @code{-L}. +This is implemented with the options @option{-F}, @option{+l}, and @option{+L} +corresponding to @option{-f}, @option{-l}, and @option{-L}. @c END @end itemize @@ -1281,7 +1330,7 @@ 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 +Support custom balloon styles using the option @option{-b}, @option{-B} will list all available. This list depends on whether you are invoking @command{ponysay} @end itemize @@ -1295,14 +1344,14 @@ Nothing worth mention. @itemize @bullet @item -@code{applebumkin} is renamed to @code{applebumpkin}. +@file{applebumkin} is renamed to @file{applebumpkin}. @item -New ponies: @code{purplehaze}, @code{owlowiscious} +New ponies: @file{owlowiscious}, @file{purplehaze} @item Cowsay has be reimplemented, and have full Unicode support and support -for @code{figlet} style messages. +for @command{figlet} style messages. @item -Deleted environment variables: @code{PONYSAY_COWSAY}, @code{PONYSAY_COWTHINK} +Deleted environment variables: @env{PONYSAY_COWSAY}, @env{PONYSAY_COWTHINK} @item You will need Python 3, but not GNU Bash, Perl or Cowsay. @item @@ -1348,16 +1397,16 @@ Make file is improved. @itemize @bullet @item -New ponies: @code{forestspirit}, @code{hollydash}, @code{raggedy}, @code{rhyme} +New ponies: @file{forestspirit}, @file{hollydash}, @file{raggedy}, @file{rhyme} @item -@code{sindy} is renamed to @code{powderrouge}. +@file{sindy} is renamed to @file{powderrouge}. Pony symlink added: @itemize @bullet -@item @code{sindy} → @code{powderrouge} +@item @file{sindy} → @file{powderrouge} @end itemize @item -@code{PREFIX=/some-dir} can be used when invoking @command{make}, -the default value is @code{/usr} +@option{PREFIX=/some-dir} can be used when invoking @command{make}, +the default value is @file{/usr} @end itemize @@ -1371,19 +1420,19 @@ Support for extension: kmsponies4ponysay. @item Pony symlinks added: @itemize @bullet -@item @code{mrsparkle} → @code{nightlight} -@item @code{elsie} → @code{prettyvision} +@item @file{mrsparkle} → @file{nightlight} +@item @file{elsie} → @file{prettyvision} @end itemize @item -New ponies: @code{ace}, @code{blueblood}, @code{filthyrich}, @code{gingergold}, -@code{hayfever}, @code{highscore}, @code{junebug}, @code{mrsparkle}, -@code{persnickety}, @code{ponet}, @code{screwloose}, @code{tornadobolt}. +New ponies: @file{ace}, @file{blueblood}, @file{filthyrich}, @file{gingergold}, +@file{hayfever}, @file{highscore}, @file{junebug}, @file{mrsparkle}, +@file{persnickety}, @file{ponet}, @file{screwloose}, @file{tornadobolt}. @item -@code{elsie} is renamed to @code{prettyvision}. +@file{elsie} is renamed to @file{prettyvision}. @item -@cindex @command{-f} -Arbitrary spaces in @command{-f} argument is not longer accepted (it causes problems with -file names including spaces.) +@cindex @option{-f} +Arbitrary spaces in @option{-f} argument is not longer accepted (it causes +problems with file names including spaces.) @end itemize @b{Note}: Identifies itself as version 1.1 @@ -1401,40 +1450,42 @@ Shell completion for @command{ponythink} added, in addition to @command{ponysay} @item @command{fish} completion added. @item -@code{/usr/lib/ponysay} is used instead of @code{/usr/bin} for code used by the main script. +@file{/usr/lib/ponysay} is used instead of @file{/usr/bin} for code used by the +main script. @item -@code{~/.local/share/ponysay} is used for private pony directories. +@file{~/.local/share/ponysay} is used for private pony directories. @item @command{ncurses} is no longer needed for determining the screen's size, @command{coreutils} is used instead. @item Pony symlinks added: @itemize @bullet -@item @code{amethyststar} → @code{sparkler} -@item @code{berrypinch} → @code{ruby} -@item @code{craftycrate} → @code{boxxy} -@item @code{magnum} → @code{raritysdad} -@item @code{pearl} → @code{raritysmom} -@item @code{powderrouge} → @code{sindy} -@item @code{royalribbo} → @code{violet} +@item @file{amethyststar} → @file{sparkler} +@item @file{berrypinch} → @file{ruby} +@item @file{craftycrate} → @file{boxxy} +@item @file{magnum} → @file{raritysdad} +@item @file{pearl} → @file{raritysmom} +@item @file{powderrouge} → @file{sindy} +@item @file{royalribbo} → @file{violet} @end itemize @item -@w{New ponies:} @code{blossomforth}, @code{bonvoyage}, @code{cadance}, @code{celestiasmall}, -@code{changelingqueen}, @code{cherryberry}, @code{discordamused}, @code{discordpuppetmaster}, -@code{fleurdelishair}, @code{fleurdelislay}, @code{owl}, @code{perrypierce}, @code{petunia}, -@code{pinacolada}, @code{skyra}, @code{truffleshuffle}. +@w{New ponies:} @file{blossomforth}, @file{bonvoyage}, @file{cadance}, +@file{celestiasmall}, @file{changelingqueen}, @file{cherryberry}, +@file{discordamused}, @file{discordpuppetmaster}, @file{fleurdelishair}, +@file{fleurdelislay}, @file{owl}, @file{perrypierce}, @file{petunia}, +@file{pinacolada}, @file{skyra}, @file{truffleshuffle}. @item -Pony spelling removed: @code{fillycadence}. +Pony spelling removed: @file{fillycadence}. @item -Pony symlink change: @code{perry} → @{@code{pokey} → @code{perrypierce}@}. +Pony symlink change: @file{perry} → @{@file{pokey} → @file{perrypierce}@}. @item -@cindex @command{-L} -Option @command{-L} added, lists ponies with symlink mapping. +@cindex @option{-L} +Option @option{-L} added, lists ponies with symlink mapping. @item Support for extension: ponyquotes4ponysay. @item -@cindex @command{-f} -Accepts arbitrary spaces in @command{-f} argument. +@cindex @option{-f} +Accepts arbitrary spaces in @option{-f} argument. @end itemize @@ -1444,24 +1495,25 @@ Accepts arbitrary spaces in @command{-f} argument. @item Spanish translation of the manpage is added. @item -@w{New ponies:} @code{applecore}, @code{applejackscarecrow}, @code{bonbonstand}, -@code{changeling}, @code{chrysalis}, @code{cottoncloudy}, @code{diamondmint}, -@code{discord}, @code{fillycadence}, @code{flam}, @code{fleurdelis}, @code{flim}, -@code{fluttershyshy}, @code{fluttershystare}, @code{lyrasit}, @w{@code{oinkoinkoink} -(is pinkie)}, @code{philomenaphoenix}, @code{pinkiecannon}, @code{pinkiecannonfront}, -@code{pinkiecannonhappy}, @code{pinkiegummy}, @code{pinkiehugfluttershy}, -@code{pinkiehugsfluttershy}, @code{pinkiepartycannon}, @code{pinkieprincess}, -@code{pinkiesilly}, @code{pinkietongue}, @code{pinkiewhoops}, @code{pinkiewhoopseat}, -@code{pinkiewhoopsout}, @code{rainbowdrag}, @code{rainbowsalute}, @code{rainbowshine}, -@code{raritydrama}, @code{shiningarmor}, @code{shiningarmorguard}, @code{snowflake}, -@code{spikemustache}, @code{stevenmagnet}, @code{stevenmagnettrue}, -@code{twilightcrazyfromball}, @code{twilightrage}, @code{twilightzero}, @code{wildfire}. +@w{New ponies:} @file{applecore}, @file{applejackscarecrow}, @file{bonbonstand}, +@file{changeling}, @file{chrysalis}, @file{cottoncloudy}, @file{diamondmint}, +@file{discord}, @file{fillycadence}, @file{flam}, @file{fleurdelis}, @file{flim}, +@file{fluttershyshy}, @file{fluttershystare}, @file{lyrasit}, @file{oinkoinkoink} +(is pinkie), @file{philomenaphoenix}, @file{pinkiecannon}, @file{pinkiecannonfront}, +@file{pinkiecannonhappy}, @file{pinkiegummy}, @file{pinkiehugfluttershy}, +@file{pinkiehugsfluttershy}, @file{pinkiepartycannon}, @file{pinkieprincess}, +@file{pinkiesilly}, @file{pinkietongue}, @file{pinkiewhoops}, @file{pinkiewhoopseat}, +@file{pinkiewhoopsout}, @file{rainbowdrag}, @file{rainbowsalute}, @file{rainbowshine}, +@file{raritydrama}, @file{shiningarmor}, @file{shiningarmorguard}, @file{snowflake}, +@file{spikemustache}, @file{stevenmagnet}, @file{stevenmagnettrue}, +@file{twilightcrazyfromball}, @file{twilightrage}, @file{twilightzero}, +@file{wildfire}. @item Pony symlinks added: @itemize @bullet -@item @code{djpon-3} → @code{vinyl} -@item @code{fillycadance} → @code{fillycadence} -@item @code{horsepower} → @code{snowflake} +@item @file{djpon-3} → @file{vinyl} +@item @file{fillycadance} → @file{fillycadence} +@item @file{horsepower} → @file{snowflake} @end itemize @item Improved TTY support: ponies have low colours resolution, instead of monochrome, @@ -1475,29 +1527,29 @@ when the high colour resolution is not available. @item Manpage manual added. @item -The directories for pony directories are changed from @code{/usr/share} to -@code{/usr/share/ponysay} and @code{~} to @code{~/.ponysay}. +The directories for pony directories are changed from @file{/usr/share} to +@file{/usr/share/ponysay} and @file{~} to @file{~/.ponysay}. @item Pony symlinks added: @itemize @bullet -@item @code{carrottop} → @code{carrot} -@item @code{goldenharvest} → @code{carrot} -@item @code{harpass} → @code{lyra} -@item @code{heartstrings} → @code{lyra} -@item @code{lulamoon} → @code{trixie} -@item @code{minuette} → @code{colgate} -@item @code{noteworthy} → @code{blues} -@item @code{perry} → @code{pokey} -@item @code{pokeypierce} → @code{pokey} -@item @code{timeturner} → @code{doctornohat} -@item @code{trixielulamoon} → @code{trixie} -@item @code{twilightvelvet} → @code{mrssparkle} +@item @file{carrottop} → @file{carrot} +@item @file{goldenharvest} → @file{carrot} +@item @file{harpass} → @file{lyra} +@item @file{heartstrings} → @file{lyra} +@item @file{lulamoon} → @file{trixie} +@item @file{minuette} → @file{colgate} +@item @file{noteworthy} → @file{blues} +@item @file{perry} → @file{pokey} +@item @file{pokeypierce} → @file{pokey} +@item @file{timeturner} → @file{doctornohat} +@item @file{trixielulamoon} → @file{trixie} +@item @file{twilightvelvet} → @file{mrssparkle} @end itemize @item Support for truncating output on height, enabled by default under TTY. @item -Environment variables added: @code{PONYSAY_FULL_WIDTH}, @code{PONYSAY_SHELL_LINES}, -@code{PONYSAY_TRUNCATE_HEIGHT}, @code{PONYSAY_BOTTOM}. +Environment variables added: @env{PONYSAY_FULL_WIDTH}, @env{PONYSAY_SHELL_LINES}, +@env{PONYSAY_TRUNCATE_HEIGHT}, @env{PONYSAY_BOTTOM}. @end itemize @@ -1513,11 +1565,12 @@ Support for TTY (Linux VT). @item @command{zsh} completion added. @item -@w{New ponies}: @code{allie}, @code{archer}, @code{boxxy}, @code{carecake}, @code{cupcake}, -@code{daringdo}, @code{davenport}, @code{fancypants}, @code{ironwillwalk}, @code{lily}, -@code{lunafly}, @code{maredowellfly}, @code{maredowellgallop}, @code{master}, @code{mjolna}, -@code{orange}, @code{raritysdad}, @code{raritysmom}, @code{royalnightguard}, @code{ruby}, -@code{sparkler}, @code{violet}. +@w{New ponies}: @file{allie}, @file{archer}, @file{boxxy}, @file{carecake}, +@file{cupcake}, @file{daringdo}, @file{davenport}, @file{fancypants}, +@file{ironwillwalk}, @file{lily}, @file{lunafly}, @file{maredowellfly}, +@file{maredowellgallop}, @file{master}, @file{mjolna}, @file{orange}, +@file{raritysdad}, @file{raritysmom}, @file{royalnightguard}, @file{ruby}, +@file{sparkler}, @file{violet}. @end itemize @@ -1525,27 +1578,28 @@ Support for TTY (Linux VT). @itemize @bullet @item -@w{New ponies}: @code{aloe}, @code{angle}, @code{applebloom}, @code{applebumkin}, -@code{applefritter}, @code{berrypunch}, @code{bigmac}, @code{blinkie}, @code{blues}, -@code{braeburn}, @code{caesar}, @code{candymane}, @code{caramel}, @code{cheerilee}, -@code{cheerilee80}, @code{clyde}, @code{colgate}, @code{colton}, @code{daisy}, -@code{derpystand}, @code{derpystandwing}, @code{diamondtiara}, @code{dinky}, -@code{doctornohat}, @code{elsie}, @code{fido}, @code{fillycelestia}, @code{fillydash}, -@code{fillydashfly}, @code{fillyjack}, @code{fillyjacktravel}, @code{fillypinkie}, -@code{fillypinkiecurly}, @code{fillyrarity}, @code{fillyshy}, @code{fluttershygala}, -@code{gilda}, @code{gildastand}, @code{granny}, @code{grannychair}, @code{grannysleep}, -@code{gummy}, @code{hoity}, @code{horte}, @code{inky}, @code{laflour}, @code{lightning}, -@code{lintsalot}, @code{lotus}, @code{mayor}, @code{mrssparkle}, @code{nightmare}, -@code{opal}, @code{parasprite}, @code{philomena}, @code{photofinish}, @code{pinkamina}, -@code{pinkiebounce}, @code{pinkiechicken}, @code{pinkiegala}, @code{pipsqueak}, -@code{pokey}, @code{rainbowfly}, @code{rainbowgala}, @code{rainbowsleep}, @code{raindrops}, -@code{rarityfly}, @code{raritygala}, @code{rarityponder}, @code{redheart}, @code{rocky}, -@code{rose}, @code{rover}, @code{royalguard}, @code{sapphire}, @code{scootaloo}, -@code{screwball}, @code{shadowbolts}, @code{silverspoon}, @code{silverstar}, @code{sindy}, -@code{snails}, @code{snips}, @code{soarin}, @code{soigne}, @code{spike}, @code{spikefloat}, -@code{spikelove}, @code{spot}, @code{stella}, @code{strongheart}, @code{sue}, -@code{suedance}, @code{tank}, @code{trixiestage}, @code{trixiestand}, @code{turnip}, -@code{twist}, @code{winona}. +@w{New ponies}: @file{aloe}, @file{angle}, @file{applebloom}, @file{applebumkin}, +@file{applefritter}, @file{berrypunch}, @file{bigmac}, @file{blinkie}, @file{blues}, +@file{braeburn}, @file{caesar}, @file{candymane}, @file{caramel}, @file{cheerilee}, +@file{cheerilee80}, @file{clyde}, @file{colgate}, @file{colton}, @file{daisy}, +@file{derpystand}, @file{derpystandwing}, @file{diamondtiara}, @file{dinky}, +@file{doctornohat}, @file{elsie}, @file{fido}, @file{fillycelestia}, +@file{fillydash}, @file{fillydashfly}, @file{fillyjack}, @file{fillyjacktravel}, +@file{fillypinkie}, @file{fillypinkiecurly}, @file{fillyrarity}, @file{fillyshy}, +@file{fluttershygala}, @file{gilda}, @file{gildastand}, @file{granny}, +@file{grannychair}, @file{grannysleep}, @file{gummy}, @file{hoity}, @file{horte}, +@file{inky}, @file{laflour}, @file{lightning}, @file{lintsalot}, @file{lotus}, +@file{mayor}, @file{mrssparkle}, @file{nightmare}, @file{opal}, @file{parasprite}, +@file{philomena}, @file{photofinish}, @file{pinkamina}, @file{pinkiebounce}, +@file{pinkiechicken}, @file{pinkiegala}, @file{pipsqueak}, @file{pokey}, +@file{rainbowfly}, @file{rainbowgala}, @file{rainbowsleep}, @file{raindrops}, +@file{rarityfly}, @file{raritygala}, @file{rarityponder}, @file{redheart}, +@file{rocky}, @file{rose}, @file{rover}, @file{royalguard}, @file{sapphire}, +@file{scootaloo}, @file{screwball}, @file{shadowbolts}, @file{silverspoon}, +@file{silverstar}, @file{sindy}, @file{snails}, @file{snips}, @file{soarin}, +@file{soigne}, @file{spike}, @file{spikefloat}, @file{spikelove}, @file{spot}, +@file{stella}, @file{strongheart}, @file{sue}, @file{suedance}, @file{tank}, +@file{trixiestage}, @file{trixiestand}, @file{turnip}, @file{twist}, @file{winona}. @end itemize @b{Note}: Identifies itself as version 0.7 @@ -1555,10 +1609,11 @@ Support for TTY (Linux VT). @itemize @bullet @item -@w{New ponies}: @code{carrot}, @code{octavia}, @code{trixie}, @code{vinyl}, @code{zecora}. +@w{New ponies:} @file{carrot}, @file{octavia}, @file{trixie}, @file{vinyl}, +@file{zecora}. @item -@cindex @command{-l} -Support for listing ponies with @command{-l} option. +@cindex @option{-l} +Support for listing ponies with @option{-l} option. @end itemize @@ -1566,8 +1621,8 @@ Support for listing ponies with @command{-l} option. @itemize @bullet @item -@w{New ponies}: @code{bonbon}, @code{celestia}, @code{doctor}, @code{fillistia}, -@code{spitfire}, @w{@code{woona} (not moonstuck)}. +@w{New ponies:} @file{bonbon}, @file{celestia}, @file{doctor}, @file{fillistia}, +@file{spitfire}, @file{woona} (not moonstuck). @item Dropping usage of utility @command{which}, using @command{hash} instead. @end itemize @@ -1587,15 +1642,15 @@ Using utility @command{which} to determine existence of @command{cowsay}. @itemize @bullet @item -@code{.cow} files are removed. +@file{.cow} files are removed. @item -@cindex @command{-W} -Support for @command{-W} option. +@cindex @option{-W} +Support for @option{-W} option. @item Select random pony if not specified. @item -@cindex @command{-f} -@command{-f} supports file names, and not only pony names. +@cindex @option{-f} +@option{-f} supports file names, and not only pony names. @end itemize @@ -1603,7 +1658,7 @@ Select random pony if not specified. @itemize @bullet @item -Fixed use of @code{.pony} files. +Fixed use of @file{.pony} files. @end itemize @@ -1611,14 +1666,14 @@ Fixed use of @code{.pony} files. @itemize @bullet @item -Pony files end with @code{.pony} instead of @code{.cow}. +Pony files end with @file{.pony} instead of @file{.cow}. @item -@code{lyrasleep} is renamed to @code{lyra}. +@file{lyrasleep} is renamed to @file{lyra}. @item -@code{.cow} files are kept but not used. +@file{.cow} files are kept but not used. @item -@cindex @command{-h} -@command{-h} prints proper help. +@cindex @option{-h} +@option{-h} prints proper help. @end itemize @@ -1628,9 +1683,9 @@ First release. @itemize @bullet @item -@w{Includes the ponies}: @code{applejack}, @code{derpy}, @code{derpysit}, -@code{fluttershy}, @code{luna}, @code{lyrasleep}, @code{pinkie}, @code{rainbow}, -@code{rarity}, @code{sweetie}, @code{twilight}. +@w{Includes the ponies}: @file{applejack}, @file{derpy}, @file{derpysit}, +@file{fluttershy}, @file{luna}, @file{lyrasleep}, @file{pinkie}, @file{rainbow}, +@file{rarity}, @file{sweetie}, @file{twilight}. @end itemize diff --git a/ponysay.pdf b/ponysay.pdf index 072c22b..f90f885 100644 Binary files a/ponysay.pdf and b/ponysay.pdf differ -- cgit