Skip to content

Commit

Permalink
Add --list option to fabulous-text
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Jul 4, 2016
1 parent 5616b9d commit e4c46af
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fabulous/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ def main():
"""Main function for :command:`fabulous-text`."""
import optparse
parser = optparse.OptionParser()
parser.add_option(
"-l", "--list", dest="list", action="store_true", default=False,
help=("List available fonts"))
parser.add_option(
"-S", "--skew", dest="skew", type="int", default=None,
help=("Apply skew effect (measured in pixels) to make it look "
Expand Down Expand Up @@ -239,10 +242,13 @@ def main():
"-s", "--shadow", dest="shadow", action="store_true", default=False,
help=("Size of font in points. Default: %default"))
(options, args) = parser.parse_args(args=sys.argv[1:])

if options.list:
print "\n".join(sorted(set(os.path.splitext(f)[0]
for _, fs in get_font_files()
for f in fs)))
return
if options.term_color:
utils.term.bgcolor = options.term_color

for line in " ".join(args).split("\n"):
fab_text = Text(line, skew=options.skew, color=options.color,
font=options.font, fsize=options.fsize,
Expand Down

0 comments on commit e4c46af

Please sign in to comment.