From 648ac6ff02842dac6f1008cf676e0242532ef570 Mon Sep 17 00:00:00 2001 From: gryf Date: Wed, 17 Feb 2021 21:56:36 +0100 Subject: [PATCH] Added argument parsing --- urxvt.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/urxvt.py b/urxvt.py index b875cfe..14c6b3a 100755 --- a/urxvt.py +++ b/urxvt.py @@ -1,4 +1,11 @@ #!/usr/bin/env python +""" +Wrapper for launchin urxvt terminal emulator. It supports automatically +generated font list for normal and bold typefaces, setting up bitmap font as a +main one, selecting an icon and so on. + +Consult options below. +""" import argparse import collections @@ -93,6 +100,32 @@ def _get_font_list(ff_list, bold=False, bmp_first=False): def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('-d', '--default-font', default=DEFAULT_FONT, + help='use particular (comma separated) font face(s) ' + 'as default(s) one, should be provided by font name, ' + 'not file name(s), default is "%s"' % DEFAULT_FONT) + parser.add_argument('-b', '--bitmap', action='store_true', help='use ' + 'bitmap font in addition to scalable defined above') + parser.add_argument('-i', '--icon', default=ICON, help='select icon from ' + '%s, default "%s"' % (ICON_PATH, ICON)) + parser.add_argument('-t', '--tabbedalt', action='store_true', + help='activate tabbedalt extension') + parser.add_argument('-s', '--size', default=SIZE, type=int, + help='set scalable forn size, default %s' % SIZE) + + parser.add_argument('-e', '--exec', help='pass exec to urxvt') + parser.add_argument('-n', '--no-perl', action='store_true', + help='no perl extensions') + group = parser.add_mutually_exclusive_group() + group.add_argument("-q", "--quiet", help='please, be quiet. Adding more ' + '"q" will decrease verbosity', action="count", + default=0) + group.add_argument("-v", "--verbose", help='be verbose. Adding more "v" ' + 'will increase verbosity', action="count", default=0) + + args = parser.parse_args() + font_faces = _ADDITIONAL_FONTS[:] font_faces.insert(0, DEFAULT_TTF) regular = _get_font_list(font_faces)