...
 
Commits (42)
*.pyc
*~
.*.swp
/build/
/dist/
/pyfiglet.egg-info/
language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
- "pypy"
before_install:
- "sudo apt-get update -qq"
- "sudo apt-get install -qq toilet figlet"
install:
- "pip install -r requirements.txt || true"
- "pip install ."
script: python pyfiglet/test.py
This diff is collapsed.
include pyfiglet/fonts/*.flf
recursive-include doc *
All of the documentation and the majority of the work done was by
Christopher Jones (cjones@insub.org).
Packaged by Peter Waller <peter.waller@gmail.com>,
various enhancements by Stefano Rivera <stefano@rivera.za.net>.
_|_| _| _| _|
_|_|_| _| _| _| _|_|_| _| _|_| _|_|_|_|
_| _| _| _| _|_|_|_| _| _| _| _| _|_|_|_| _|
_| _| _| _| _| _| _| _| _| _| _|
_|_|_| _|_|_| _| _| _|_|_| _| _|_|_| _|_|
_| _| _|
_| _|_| _|_|
SYNOPSIS
pyfiglet is a full port of FIGlet (http://www.figlet.org/) into pure
python. It takes ASCII text and renders it in ASCII art fonts (like
the title above, which is the 'block' font).
FAQ
Q. Why? WHY?!
A. I was bored. Really bored.
Q. What the hell does this do that FIGlet doesn't?
A. Not much, except allow your font collection to live
in one big zipfile. The point of this code is to embed
dynamic figlet rendering in Python without having to
execute an external program, although it operates on the
commandline as well. See below for USAGE details. You can
think of this as a python FIGlet driver.
Q. Does this support kerning/smushing like FIGlet?
A. Yes, yes it does. Output should be identical to FIGlet. If
not, this is a bug, which you should report to me!
Q. Can I use/modify/redstribute this code?
A. Yes, under the terms of the GPL (see LICENSE below).
Q. I improved this code, what should I do with it?
A. You can mail patches to <cjones@insub.org>. Particularly bugfixes.
If you make changes to the kerning/mushing/rendering portion, PLEASE
test it throroughly. The code is fragile and complex.
USAGE
You can use pyfiglet in one of two ways. First, it operates on the
commandline as C figlet does and supports most of the same options.
Run with --help to see a full list of tweaks. Mostly you will only
use -f to change the font. It defaults to standard.flf.
tools/pyfiglet 'text to render'
Pyfiglet is also a library that can be used in python code:
from pyfiglet import Figlet
f = Figlet(font='slant')
print f.renderText('text to render')
AUTHOR
pyfiglet is a *port* of FIGlet, and much of the code is directly translated
from the C source. I optimized some bits where I could, but because the smushing
and kerning code is so incredibly complex, it was safer and easier to port the logic
almost exactly. Therefore, I can't really take much credit for authorship, just
translation. The original authors of FIGlet are listed on their website at
http://www.figlet.org/.
The Python port was done by Christopher Jones <cjones@insub.org> (http://gruntle.org/).
It is currently maintained by Peter Waller (p@pwaller.net, github:pwaller)
THANKS
github:stefanor for various bug fixes and improvements and the debian packaging.
Thanks to anyone who contributed an issue or code on github!
LICENSE
Copyright (C) 2007 Christopher Jones <cjones@insub.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
(see LICENSE for full details)
CHANGELOG
2015-05-27 0.7.4
#43 Don't leak file handles
2015-04-14 0.7.3
#41 Add newline and text wrapping support
2014-09-14 0.7.2
#35 Add this CHANGELOG
#36 Bug fix for #34 (broken --reverse and --flip)
(reported "character mapping must return integer, None or unicode")
2014-07-27 0.7.1
#29 Fix for UTF8 regression
#31 Add __main__ entry point
#32 Pep8 the code and minor refactoring
#33 Trove classifiers update
2014-06-02 0.7
#9 Add --list_fonts and --info_font
#10 Add tools/pyfiglet_example for listing all fonts
#11 Fix the pyfiglet command (had bad python path)
#12 Pyflakes fixes
#13 Configure Travis Continuous Integration
#17 Documentation usage sample fix
#19 Enable pyfiglet to use extended ASCII chars
#20 Add two cyrillic fonts
#21 Python 3 support
#27 Code improvements
#28 Human readable font list (-l)
pyfiglet (0.7.4+dfsg-4) unstable; urgency=medium
* Team upload.
* Use debhelper-compat instead of debian/compat.
* Drop Python 2 support.
* Bump debhelper compat level to 12.
* Bump standards version to 4.4.0 (no changes).
-- Ondřej Nový <onovy@debian.org> Sat, 10 Aug 2019 13:16:31 +0200
pyfiglet (0.7.4+dfsg-3) unstable; urgency=medium
[ Ondřej Nový ]
* Fixed VCS URL (https)
* d/control: Set Vcs-* to salsa.debian.org
* d/copyright: Use https protocol in Format field
* d/tests: Use AUTOPKGTEST_TMP instead of ADTTMP
* d/control: Remove ancient X-Python-Version field
* d/control: Remove ancient X-Python3-Version field
* Convert git repository from git-dpm to gbp layout
[ Stefano Rivera ]
* Bump debhelper compat to 11.
* Bump Standards-Version to 4.2.1, no changes needed.
* Bump copyright years.
* Declare Rules-Requires-Root: no.
-- Stefano Rivera <stefanor@debian.org> Mon, 27 Aug 2018 11:55:20 +0100
pyfiglet (0.7.4+dfsg-2) unstable; urgency=medium
* Patch py3k: Don't attempt to decode command line args in py3k.
......
......@@ -4,31 +4,17 @@ Priority: optional
Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Uploaders: Stefano Rivera <stefanor@debian.org>
Build-Depends:
debhelper (>= 8.1),
debhelper-compat (= 12),
dh-python,
figlet,
python-all (>= 2.6),
python-setuptools,
python3-all,
python3-setuptools,
toilet
X-Python-Version: >= 2.6
X-Python3-Version: >= 3.1
Standards-Version: 3.9.6
Standards-Version: 4.4.0
Homepage: https://github.com/pwaller/pyfiglet
Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/pyfiglet/trunk/
Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/pyfiglet/trunk/
Package: python-pyfiglet
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}
Recommends: figlet, toilet-fonts
Description: Python port of the FIGlet specification
FIGLet is a program that creates large characters out of ordinary screen
characters. It takes ASCII text and renders it in ASCII art fonts.
.
This is a Python port of the original C figlet. It can be used on the
commandline or as an Object Oriented driver library in your own programs.
Vcs-Git: https://salsa.debian.org/python-team/modules/pyfiglet.git
Vcs-Browser: https://salsa.debian.org/python-team/modules/pyfiglet
Rules-Requires-Root: no
Package: python3-pyfiglet
Architecture: all
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pyfiglet
Upstream-Contact: Peter Waller <peter.waller@gmail.com>
Source: https://github.com/pwaller/pyfiglet
......@@ -24,7 +24,7 @@ Copyright: 2007, Christopher Jones <cjones@gmail.com>,
License: GPL-2+
Files: debian/*
Copyright: 2010-2015, Stefano Rivera <stefanor@debian.org>
Copyright: 2010-2018, Stefano Rivera <stefanor@debian.org>
License: GPL-2+
License: GPL-2+
......
Description: Skip some toilet fonts from the test suite.
They don't all pass, beacuse pyfiglet doesn't have perfect .tlf handling yet.
Author: Stefano Rivera <stefanor@debian.org>
From: Stefano Rivera <stefanor@debian.org>
Date: Thu, 8 Oct 2015 10:29:40 -0700
Subject: Skip some toilet fonts from the test suite.
They don't all pass, because pyfiglet doesn't have perfect .tlf handling yet.
Forwarded: https://github.com/pwaller/pyfiglet/pull/44
Last-Updated: 2015-07-03
---
pyfiglet/test.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pyfiglet/test.py b/pyfiglet/test.py
index fe28087..d57a915 100755
--- a/pyfiglet/test.py
+++ b/pyfiglet/test.py
@@ -34,6 +34,8 @@
@@ -34,6 +34,8 @@ class Test(object):
self.failed = []
self.oked = []
self.skip = ['runic','pyramid','eftifont'] # known bug..
......
Description: Debian figlet defaults.
Change defaults to be toilet-compatible (font: future)
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: not-needed
Last-Update: 2011-05-29
--- a/pyfiglet/__init__.py
+++ b/pyfiglet/__init__.py
@@ -36,7 +36,7 @@
"""
-DEFAULT_FONT = 'standard'
+DEFAULT_FONT = 'future'
def figlet_format(text, font=DEFAULT_FONT, **kwargs):
Description: Use Debian's figlet fonts.
Look in /usr/share/figlet rather than using pkg_resources to find fonts.
Author: Stefano Rivera <stefanor@debian.org>
From: Stefano Rivera <stefanor@debian.org>
Date: Thu, 8 Oct 2015 10:29:38 -0700
Subject: Use Debian's figlet fonts.
Look in /usr/share/figlet rather than using pkg_resources to find fonts.
Forwarded: not-needed
Last-Update: 2014-07-26
---
pyfiglet/__init__.py | 10 +++++-----
pyfiglet/test.py | 6 +++---
setup.py | 3 +--
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/pyfiglet/__init__.py b/pyfiglet/__init__.py
index 7329746..a33eaf8 100755
--- a/pyfiglet/__init__.py
+++ b/pyfiglet/__init__.py
@@ -7,7 +7,7 @@
@@ -7,7 +7,7 @@ Python FIGlet adaption
from __future__ import print_function, unicode_literals
......@@ -15,7 +25,7 @@ Last-Update: 2014-07-26
import re
import sys
from optparse import OptionParser
@@ -97,8 +97,8 @@
@@ -97,8 +97,8 @@ class FigletFont(object):
"""
for extension in ('tlf', 'flf'):
fn = '%s.%s' % (font, extension)
......@@ -26,7 +36,7 @@ Last-Update: 2014-07-26
data = data.decode('UTF-8', 'replace')
return data
else:
@@ -108,7 +108,7 @@
@@ -108,7 +108,7 @@ class FigletFont(object):
def isValidFont(cls, font):
if not font.endswith(('.flf', '.tlf')):
return False
......@@ -35,7 +45,7 @@ Last-Update: 2014-07-26
header = f.readline().decode('UTF-8', 'replace')
f.close()
return cls.reMagicNumber.search(header)
@@ -116,7 +116,7 @@
@@ -116,7 +116,7 @@ class FigletFont(object):
@classmethod
def getFonts(cls):
return [font.rsplit('.', 2)[0] for font
......@@ -44,21 +54,11 @@ Last-Update: 2014-07-26
if cls.isValidFont(font)]
@classmethod
--- a/setup.py
+++ b/setup.py
@@ -46,8 +46,7 @@
author='Peter Waller (Thanks to Christopher Jones and Stefano Rivera)',
author_email='peter.waller@gmail.com',
url='https://github.com/pwaller/pyfiglet',
- packages=['pyfiglet', 'pyfiglet.fonts'],
- package_data={'pyfiglet.fonts': ['*.flf']},
+ packages=['pyfiglet'],
entry_points={
'console_scripts': [
'pyfiglet = pyfiglet:main',
diff --git a/pyfiglet/test.py b/pyfiglet/test.py
index 6872201..fe28087 100755
--- a/pyfiglet/test.py
+++ b/pyfiglet/test.py
@@ -38,9 +38,9 @@
@@ -38,9 +38,9 @@ class Test(object):
def outputUsingFigletorToilet(self, text, font, fontpath):
if os.path.isfile(fontpath + '.flf'):
......@@ -70,7 +70,7 @@ Last-Update: 2014-07-26
else:
raise Exception('Missing font file: '+fontpath)
@@ -71,7 +71,7 @@
@@ -71,7 +71,7 @@ class Test(object):
def check_font(self, text, font):
if font in self.skip:
return
......@@ -79,3 +79,17 @@ Last-Update: 2014-07-26
self.f.setFont(font=font)
diff --git a/setup.py b/setup.py
index 43cba4d..10095c6 100755
--- a/setup.py
+++ b/setup.py
@@ -46,8 +46,7 @@ setup(
author='Peter Waller (Thanks to Christopher Jones and Stefano Rivera)',
author_email='peter.waller@gmail.com',
url='https://github.com/pwaller/pyfiglet',
- packages=['pyfiglet', 'pyfiglet.fonts'],
- package_data={'pyfiglet.fonts': ['*.flf']},
+ packages=['pyfiglet'],
entry_points={
'console_scripts': [
'pyfiglet = pyfiglet:main',
Description: Don't install setuptools entry point scripts.
We have our own command line wrapper.
Author: Stefano Rivera <stefanor@debian.org>
From: Stefano Rivera <stefanor@debian.org>
Date: Thu, 8 Oct 2015 10:29:39 -0700
Subject: Don't install setuptools entry point scripts.
We have our own command line wrapper.
Forwarded: not-needed
Last-Update: 2014-07-27
---
setup.py | 5 -----
1 file changed, 5 deletions(-)
diff --git a/setup.py b/setup.py
index 10095c6..4d16851 100755
--- a/setup.py
+++ b/setup.py
@@ -47,9 +47,4 @@
@@ -47,9 +47,4 @@ setup(
author_email='peter.waller@gmail.com',
url='https://github.com/pwaller/pyfiglet',
packages=['pyfiglet'],
......
Description: In Python 3, args are already decoded
Author: Stefano Rivera <stefanor@debian.org>
From: Stefano Rivera <stefanor@debian.org>
Date: Thu, 8 Oct 2015 10:29:41 -0700
Subject: In Python 3, args are already decoded
Forwarded: https://github.com/pwaller/pyfiglet/pull/45
Last-Updated: 2015-07-03
---
pyfiglet/__init__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pyfiglet/__init__.py b/pyfiglet/__init__.py
index a33eaf8..ff0bea5 100755
--- a/pyfiglet/__init__.py
+++ b/pyfiglet/__init__.py
@@ -791,7 +791,8 @@
@@ -791,7 +791,8 @@ def main():
parser.print_help()
return 1
......
......@@ -3,7 +3,7 @@
export PYBUILD_NAME=pyfiglet
%:
dh $@ --with python2,python3 --buildsystem pybuild
dh $@ --with python3 --buildsystem pybuild
override_dh_auto_test:
PYBUILD_SYSTEM=custom \
......
Tests: smoketest
Depends: figlet, python-pyfiglet, toilet-fonts
Tests: smoketest3
Depends: figlet, python3-pyfiglet, toilet-fonts
Tests: suite
Depends: python-all, python-pyfiglet, figlet, toilet
Tests: suite3
Depends: python3-all, python3-pyfiglet, figlet, toilet
#!/bin/sh
set -efu
cd "$ADTTMP"
python -m pyfiglet --help
python -m pyfiglet hello there
python -m pyfiglet -f letter haai
#!/bin/sh
set -efu
cd "$ADTTMP"
cd "$AUTOPKGTEST_TMP"
pyfiglet --help
pyfiglet hello there
......
#!/bin/sh
set -efu
cd "$ADTTMP"
for py in $(pyversions --supported); do
$py -m pyfiglet.test
done
#!/bin/sh
set -efu
cd "$ADTTMP"
cd "$AUTOPKGTEST_TMP"
for py in $(py3versions --supported); do
$py -m pyfiglet.test
......
.TH PYFIGLET "1" "June 2011" "pyfiglet 0.6" "User Commands"
.SH NAME
pyfiglet \- display text in large ASCII art fonts.
.SH SYNOPSIS
.B pyfiglet.py
[\fIoptions\fR] \fItext\fR...
.SH DESCRIPTION
pyFIGlet is a program that creates large characters out of ordinary
screen characters.
It takes ASCII text (\fItext\fR) and renders it in ASCII art fonts.
.P
This version of pyfiglet supports FIGlet fonts \fB.flf\fR and
the FIGlet-compatible toilet-fonts \fB.tlf\fR.
.SH OPTIONS
.TP
\fB\-\-version\fR
show program's version number and exit
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-f\fR \fIFONT\fR, \fB\-\-font\fR=\fIFONT\fR
font to render with (default: future)
.TP
\fB\-D\fR \fIDIRECTION\fR, \fB\-\-direction\fR=\fIDIRECTION\fR
set direction text will be formatted in (default:
auto)
.TP
\fB\-j\fR \fISIDE\fR, \fB\-\-justify\fR=\fISIDE\fR
set justification, defaults to print direction
.TP
\fB\-w\fR \fICOLS\fR, \fB\-\-width\fR=\fICOLS\fR
set terminal width for wrapping/justification
(default: 80)
.TP
\fB\-r\fR, \fB\-\-reverse\fR
shows mirror image of output text
.TP
\fB\-F\fR, \fB\-\-flip\fR
flips rendered output text over
.SH "SEE ALSO"
.BR toilet (1),
.BR figlet (1)
This diff is collapsed.
import sys
from pyfiglet import main
if __name__ == '__main__':
sys.exit(main())
#!/usr/bin/env python
from __future__ import print_function
import os.path
import sys
from optparse import OptionParser
from pyfiglet import Figlet
from subprocess import Popen, PIPE
try:
from colorama import init
init(strip=not sys.stdout.isatty())
from termcolor import cprint
except:
def cprint(text, color):
print(text)
__version__ = '0.1'
def fail(text):
cprint(text, 'red')
def win(text):
cprint(text, 'green')
def dump(text):
for line in text.split('\n'):
print(repr(line))
class Test(object):
def __init__(self, opts):
self.opts = opts
self.ok = 0
self.fail = 0
self.failed = []
self.oked = []
self.skip = ['runic','pyramid','eftifont'] # known bug..
self.f = Figlet()
def outputUsingFigletorToilet(self, text, font, fontpath):
if os.path.isfile(fontpath + '.flf'):
cmd = ('figlet', '-d', 'pyfiglet/fonts', '-f', font, text)
elif os.path.isfile(fontpath + '.tlf'):
cmd = ('toilet', '-d', 'pyfiglet/fonts', '-f', font, text)
else:
raise Exception('Missing font file: '+fontpath)
p = Popen(cmd, bufsize=4096, stdout=PIPE)
outputFiglet = p.communicate()[0].decode('utf8')
return outputFiglet
def validate_font_output(self, font, outputFiglet, outputPyfiglet):
if outputPyfiglet == outputFiglet:
win('[OK] %s' % font)
self.ok += 1
self.oked.append(font)
return
fail('[FAIL] %s' % font)
self.fail += 1
self.failed.append(font)
self.show_result(outputFiglet, outputPyfiglet, font)
def show_result(self, outputFiglet, outputPyfiglet, font):
if self.opts.show is True:
print('[PYTHON] *** %s\n\n' % font)
dump(outputPyfiglet)
print('[FIGLET] *** %s\n\n' % font)
dump(outputFiglet)
raw_input()
def check_font(self, text, font):
if font in self.skip:
return
fontpath = os.path.join('pyfiglet', 'fonts', font)
self.f.setFont(font=font)
outputPyfiglet = self.f.renderText(text)
outputFiglet = self.outputUsingFigletorToilet(text, font, fontpath)
# Our TLF rendering isn't perfect, yet
strict = os.path.isfile(fontpath + '.flf')
if not strict:
outputPyfiglet = outputPyfiglet.strip('\n')
outputFiglet = outputFiglet.strip('\n')
self.validate_font_output(font, outputFiglet, outputPyfiglet)
def check_text(self, text):
for font in self.f.getFonts():
self.check_font(text, font)
def check_result(self):
print('OK = %d, FAIL = %d' % (self.ok, self.fail))
if len(self.failed) > 0:
print('FAILED = %s' % repr(self.failed))
return self.failed, self.oked
def banner(text):
cprint(Figlet().renderText(text), "blue")
def main():
parser = OptionParser(version=__version__)
parser.add_option('-s', '--show', action='store_true', default=False,
help='pause at each failure and compare output '
'(default: %default)')
opts, args = parser.parse_args()
test = Test(opts)
banner("TESTING one word")
test.check_text("foo")
banner("TESTING cut at space")
test.check_text("This is a very long text with many spaces and little words")
banner("TESTING cut at last char")
test.check_text("Averylongwordthatwillbecutatsomepoint I hope")
banner("TESTING explicit new line")
test.check_text("this text\nuse new line")
if len(test.check_result()[0]) == 0:
return 0
else:
return 1
if __name__ == '__main__':
sys.exit(main())
__version__ = '0.7.4'
#!/usr/bin/env python
from setuptools import setup
import sys
def get_version():
sys.path.insert(0, 'pyfiglet')
from version import __version__
sys.path.pop(0)
return __version__
setup(
name='pyfiglet',
version=get_version(),
description='Pure-python FIGlet implementation',
license='GPLv2+',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v2 or later '
'(GPLv2+)',
'Natural Language :: English',
# For Katakana
'Natural Language :: Japanese',
# For Cyrillic
'Natural Language :: Bulgarian',
'Natural Language :: Bosnian',
'Natural Language :: Macedonian',
'Natural Language :: Russian',
'Natural Language :: Serbian',
'Natural Language :: Ukranian',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Text Processing',
'Topic :: Text Processing :: Fonts',
],
author='Peter Waller (Thanks to Christopher Jones and Stefano Rivera)',
author_email='peter.waller@gmail.com',
url='https://github.com/pwaller/pyfiglet',
packages=['pyfiglet', 'pyfiglet.fonts'],
package_data={'pyfiglet.fonts': ['*.flf']},
entry_points={
'console_scripts': [
'pyfiglet = pyfiglet:main',
],
}
)
#!/bin/bash
set -eux
pyfiglet -f $2 "$1" > /tmp/pyfiglet
figlet -d pyfiglet/fonts -f $2 "$1"> /tmp/figlet
vimdiff /tmp/figlet /tmp/pyfiglet
#!/bin/sh
cd "$(dirname "$0")"/..
export PYTHONPATH=$(pwd)
exec python -m pyfiglet "$@"
#!/bin/sh
PYFIGLET='./pyfiglet'
OUTPUT='/tmp/pyfiglet_example.log'
TEXT='pyfiglet'
LOG=0
cd "$(dirname "$0")"
if [ ! -f "$PYFIGLET" ]; then
echo "Error ! can't find $PYFIGLET!"
fi
print_samples() {
if [ "$LOG" -eq 1 ]; then
output="$OUTPUT"
rm "$output" 2>/dev/null
else
output='/dev/null'
fi
#. strip \' \, \[ \] from font lists of pyfiglet.
fonts="$("$PYFIGLET" -l | sed -e "s/[',]//g" -e 's/^\[//g' -e 's/\]$//g')"
for font in $fonts; do
echo "$font" | tee -a "$output"
"$PYFIGLET" "$TEXT" -f "$font" | tee -a "$output"
done
}
useage() {
echo "Useage: $0 [options] [text ...]\n"
echo "Options:"
echo "-l\t\t\tcreate log file."
echo "-o [path_to_file]\tspecify the path of log file,\n\t\t\tdefault is $OUTPUT."
echo "-h\t\t\tshow help messages."
exit 0
}
#. parse apts & args
while getopts ":lo:h" opt; do
case "$opt" in
l)
LOG=1
;;
o)
if [ -n $OPTARG ]; then
OUTPUT="$OPTARG"
fi
;;
h|\?)
useage
;;
esac
done
shift `expr $OPTIND - 1`
if [ ! -z "$1" ]; then
TEXT="$@"
fi
#. main
print_samples