aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-21 02:53:01 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-21 02:53:01 +0200
commit5fa8938b957e38a930934d615e0f803e8c5a5336 (patch)
treee52a798a5e538d06b3d0c12862135dd891668934
parent5ee263a05560ef5a3031425c3f65e6d8b8d7cc3e (diff)
downloadponysay-5fa8938b957e38a930934d615e0f803e8c5a5336.tar.gz
ponysay-5fa8938b957e38a930934d615e0f803e8c5a5336.tar.bz2
ponysay-5fa8938b957e38a930934d615e0f803e8c5a5336.zip
work on colour stack + make fix
-rwxr-xr-xconfigure4
-rwxr-xr-xponysay23
2 files changed, 23 insertions, 4 deletions
diff --git a/configure b/configure
index ccc1df5..0629006 100755
--- a/configure
+++ b/configure
@@ -228,8 +228,8 @@ function makeMakefile()
done
echo
echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/bin/"'
- echo -en '\t' ; echo 'install "ponysay" "$(INSTALLDIR)/bin/ponysay"'
- echo -en '\t' ; echo 'ln -sf "ponysay" "$(INSTALLDIR)/bin/ponythink"'
+ 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/licenses/ponysay/"'
for file in $licenseFiles; do
diff --git a/ponysay b/ponysay
index db5c4a5..3a4efa3 100755
--- a/ponysay
+++ b/ponysay
@@ -1085,16 +1085,35 @@ class ColourStack():
Constructor
'''
def __init__(self, autopush, autopop):
- pass
+ self.autopush = autopush
+ self.autopop = autopop
+ self.lenpush = len(autopush)
+ self.lenpop = len(autopop)
+ self.bufproto = ' ' * (self.lenpush if self.lenpush > self.lenpop else self.lenpop)
+ self.stack = []
+ self.push()
+
def push(self):
+ self.stack = [[self.bufproto]] + self.stack
+ if len(self.stack) == 1:
+ return ''
return ''
+
def pop(self):
return ''
+
def feed(self, char):
- return ''
+ buf = self.stack[0][0]
+ 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
+ return rc