mirror of
https://github.com/erkin/ponysay.git
synced 2025-01-31 10:26:43 +01:00
Merge branch 'python' of github.com:erkin/ponysay into python
This commit is contained in:
commit
f367346ad8
2 changed files with 18 additions and 14 deletions
20
README.md
20
README.md
|
@ -12,7 +12,7 @@ First of all, you need `cowsay` from your local repositories.
|
||||||
Obtain it from [here](http://www.nog.net/~tony/warez) if you wish to compile it yourself.
|
Obtain it from [here](http://www.nog.net/~tony/warez) if you wish to compile it yourself.
|
||||||
This is often sufficient, but if is not you may be missing one of the standard packages: [bash](ftp://ftp.gnu.org/gnu/bash/), [coreutils](ftp://ftp.gnu.org/gnu/coreutils/) or [sed](ftp://ftp.gnu.org/gnu/sed/).
|
This is often sufficient, but if is not you may be missing one of the standard packages: [bash](ftp://ftp.gnu.org/gnu/bash/), [coreutils](ftp://ftp.gnu.org/gnu/coreutils/) or [sed](ftp://ftp.gnu.org/gnu/sed/).
|
||||||
|
|
||||||
[Download](https://github.com/erkin/ponysay/downloads) or clone the project.
|
[Download](/erkin/ponysay/downloads) or clone the project.
|
||||||
In the terminal, `cd` into the ponysay directory and `make && make install`.
|
In the terminal, `cd` into the ponysay directory and `make && make install`.
|
||||||
|
|
||||||
This will install ponysay into the $PREFIX (`/usr` by default, meaning you may need to `make install` as root, e.g. `sudo make install`.)
|
This will install ponysay into the $PREFIX (`/usr` by default, meaning you may need to `make install` as root, e.g. `sudo make install`.)
|
||||||
|
@ -46,7 +46,7 @@ This requires that you have the `fortune` utility installed. You can install it
|
||||||
or just fetch the source code from [here](ftp://ftp.ibiblio.org/pub/linux/games/amusements/fortune/).
|
or just fetch the source code from [here](ftp://ftp.ibiblio.org/pub/linux/games/amusements/fortune/).
|
||||||
|
|
||||||
You can try [this](http://www.reddit.com/r/mylittlelinux/comments/srixi/using_ponysay_with_a_ponified_fortune_warning/) script or
|
You can try [this](http://www.reddit.com/r/mylittlelinux/comments/srixi/using_ponysay_with_a_ponified_fortune_warning/) script or
|
||||||
[ponypipe](https://github.com/maandree/ponypipe) to ponify fortunes.
|
[ponypipe](/maandree/ponypipe) to ponify fortunes.
|
||||||
|
|
||||||
Edit your `~/.bashrc` and add this to the end of the file
|
Edit your `~/.bashrc` and add this to the end of the file
|
||||||
|
|
||||||
|
@ -84,19 +84,13 @@ Dependencies
|
||||||
|
|
||||||
### Required runtime dependencies
|
### Required runtime dependencies
|
||||||
|
|
||||||
`bash`: required for the main script [file: ponysay]
|
|
||||||
|
|
||||||
`cowsay`: this is a wrapper for cowsay
|
`cowsay`: this is a wrapper for cowsay
|
||||||
|
|
||||||
`coreutils`: the main script uses stty, cut, ls, cat, sort, readlink, pwd, head and tail
|
`python3`: Written in python3
|
||||||
|
|
||||||
`sed`: used to remove .pony from pony names when running `ponysay -l` and `ponysay -l`
|
|
||||||
|
|
||||||
`perl`: required to run `ponysay -l` and `ponysay -L`
|
|
||||||
|
|
||||||
### Package building dependencies
|
### Package building dependencies
|
||||||
|
|
||||||
`gcc`: used for compiling ponysaytruncater.c
|
`gcc`: used for compiling ponysaytruncater.c (???)
|
||||||
|
|
||||||
`gzip`: used for compressing manpages
|
`gzip`: used for compressing manpages
|
||||||
|
|
||||||
|
@ -110,13 +104,13 @@ FAQ
|
||||||
|
|
||||||
__Q:__ The output looks like a mess in _(TTY/PuTTY/other)_!
|
__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](https://github.com/erkin/ponysay/issues/1).
|
__A:__ Unfortunately, there's nothing much we can do about it. See [issue 1](/erkin/ponysay/issues/1).
|
||||||
|
|
||||||
__Q:__ You are missing _(my-favourite-pony)_!
|
__Q:__ You are missing _(my-favourite-pony)_!
|
||||||
|
|
||||||
__A:__ [Ask](https://github.com/erkin/ponysay/issues) and we'll add!
|
__A:__ [Ask](/erkin/ponysay/issues) and we'll add!
|
||||||
|
|
||||||
__Q:__ Which programs do you use to generate the pony files?
|
__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)
|
__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](https://github.com/rossy2401/img2xterm) or [util-say](https://github.com/maandree/util-say).
|
that are generated into cow files via [img2xterm](/rossy2401/img2xterm) or [util-say](/maandree/util-say).
|
||||||
|
|
12
ponysay.py
12
ponysay.py
|
@ -46,6 +46,12 @@ Whether the program is execute in Linux VT (TTY)
|
||||||
linuxvt = os.environ['TERM'] == 'linux'
|
linuxvt = os.environ['TERM'] == 'linux'
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Whether the program is launched in subshell/beeing redirected
|
||||||
|
'''
|
||||||
|
redirected = not sys.stdout.isatty()
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
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)
|
||||||
'''
|
'''
|
||||||
|
@ -81,7 +87,7 @@ parser.add_argument( '--onelist', action = 'store_true', dest = 'onelist',
|
||||||
parser.add_argument('-W', '--wrap', action = 'store', dest = 'wrap', help = 'specify the column when the message should be wrapped')
|
parser.add_argument('-W', '--wrap', action = 'store', dest = 'wrap', help = 'specify the column when the message should be wrapped')
|
||||||
parser.add_argument('-f', '--pony', action = 'append', dest = 'pony', help = 'select a pony (either a file name or a pony name)')
|
parser.add_argument('-f', '--pony', action = 'append', dest = 'pony', help = 'select a pony (either a file name or a pony name)')
|
||||||
parser.add_argument('-q', '--quote', nargs = '*', dest = 'quote', help = 'select a pony which will quote herself')
|
parser.add_argument('-q', '--quote', nargs = '*', dest = 'quote', help = 'select a pony which will quote herself')
|
||||||
parser.add_argument('message', nargs = '?', help = 'message to ponysay')
|
parser.add_argument('message', nargs = '?', help = 'message to ponysay')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
# TODO implement if [ -t 0 ] && [ $# == 0 ]; then
|
# TODO implement if [ -t 0 ] && [ $# == 0 ]; then
|
||||||
|
@ -99,6 +105,10 @@ class ponysay():
|
||||||
Starts the part of the program the arguments indicate
|
Starts the part of the program the arguments indicate
|
||||||
'''
|
'''
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
|
if args.list and redirected:
|
||||||
|
args.list = False
|
||||||
|
args.onelist = True
|
||||||
|
|
||||||
if args.list: self.list()
|
if args.list: self.list()
|
||||||
elif args.linklist: self.linklist()
|
elif args.linklist: self.linklist()
|
||||||
elif args.quoters: self.quoters()
|
elif args.quoters: self.quoters()
|
||||||
|
|
Loading…
Reference in a new issue