mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-26 06:07:59 +01:00
work on colour stack + make fix
This commit is contained in:
parent
5ee263a055
commit
5fa8938b95
2 changed files with 23 additions and 4 deletions
4
configure
vendored
4
configure
vendored
|
@ -228,8 +228,8 @@ function makeMakefile()
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/bin/"'
|
echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/bin/"'
|
||||||
echo -en '\t' ; echo 'install "ponysay" "$(INSTALLDIR)/bin/ponysay"'
|
echo -en '\t' ; echo 'install "ponysay.install" "$(INSTALLDIR)/bin/ponysay"'
|
||||||
echo -en '\t' ; echo 'ln -sf "ponysay" "$(INSTALLDIR)/bin/ponythink"'
|
echo -en '\t' ; echo 'ln -sf "ponysay" "$(INSTALLDIR)/bin/ponythink"'
|
||||||
echo
|
echo
|
||||||
echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/licenses/ponysay/"'
|
echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/licenses/ponysay/"'
|
||||||
for file in $licenseFiles; do
|
for file in $licenseFiles; do
|
||||||
|
|
23
ponysay
23
ponysay
|
@ -1085,16 +1085,35 @@ class ColourStack():
|
||||||
Constructor
|
Constructor
|
||||||
'''
|
'''
|
||||||
def __init__(self, autopush, autopop):
|
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):
|
def push(self):
|
||||||
|
self.stack = [[self.bufproto]] + self.stack
|
||||||
|
if len(self.stack) == 1:
|
||||||
|
return ''
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def pop(self):
|
def pop(self):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def feed(self, char):
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue