def run():
    '''Runs the sigpager script.'''
    parser = optparse.OptionParser(usage='%prog [options] [files to sign]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(defsig='', sigdir='', tail='', sigsep='-- \n')

    parser.add_option('-d', '--sigdir',
                      help='choose from signatures in directory SIGDIR')
    parser.add_option('-s', '--defsig',
                      help='default signature from file DEFSIG')
    parser.add_option('-t', '--tail',
                      help='signatures are read from files with suffix TAIL')
    parser.add_option('-S', '--nosep',
                      dest='sigsep', action='store_const', const='',
                      help='suppress prepending of signature separator')

    options, args = parser.parse_args()
    del parser

    try:
        s = sigpager.signature(options.defsig, options.sigdir, options.tail,
                               options.sigsep, args)
        s.sign()
    except (util.DeadMan, IOError, OSError) as inst:
        sys.exit(inst)
Beispiel #2
0
def run():
    '''Runs the sigpager script.'''
    parser = optparse.OptionParser(usage='%prog [options] [files to sign]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(defsig='', sigdir='', tail='', sigsep='-- \n')

    parser.add_option('-d',
                      '--sigdir',
                      help='choose from signatures in directory SIGDIR')
    parser.add_option('-s',
                      '--defsig',
                      help='default signature from file DEFSIG')
    parser.add_option('-t',
                      '--tail',
                      help='signatures are read from files with suffix TAIL')
    parser.add_option('-S',
                      '--nosep',
                      dest='sigsep',
                      action='store_const',
                      const='',
                      help='suppress prepending of signature separator')

    options, args = parser.parse_args()
    del parser

    try:
        s = sigpager.signature(options.defsig, options.sigdir, options.tail,
                               options.sigsep, args)
        s.sign()
    except (util.DeadMan, IOError, OSError), inst:
        sys.exit(inst)
Beispiel #3
0
def run():
    '''Runs the viewhtmlmsg script.'''
    parser = optparse.OptionParser(usage='%prog [options]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(safe=False, keep=None, app=None)
    parser.add_option('-s',
                      '--safe',
                      action='store_true',
                      help='view html w/o loading remote files')
    parser.add_option('-k',
                      '--keep',
                      type='int',
                      help='remove temporary files after KEEP seconds '
                      '(0 for keeping files)')
    parser.add_option('-b',
                      '--browser',
                      dest='app',
                      help='prefer browser APP over $BROWSER environment')

    options, args = parser.parse_args()
    del parser

    try:
        v = viewhtmlmsg.viewhtml(options.safe, options.keep, options.app, args)
        v.view()
    except (util.DeadMan, IOError, KeyboardInterrupt), inst:
        sys.exit(inst)
Beispiel #4
0
def run():
    '''Runs the urlpager script.'''
    parser = optparse.OptionParser(formatter=optparse.TitledHelpFormatter(),
                                   usage='%prog [options] [files]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(proto='all', pat=None, app=None, getdir='', ftpdir='',
                        midrelax=False, local=False, browse=False, news=False,
                        kiosk='', mhiers=None, specdirs=None, mask=None)

    parser.add_option('-p', '--protocol', dest='proto',
                      type='choice', choices=urlregex.valid_protos,
                      help='narrow down url choice to protocol PROTO')
    parser.add_option('-r', '--regex', dest='pat',
                      help='narrow down url choice to urls matching PAT')
    parser.add_option('-b', '--browser', dest='app',
                      help='prefer browser APP over $BROWSER environment')
    parser.add_option('-w', '--wget', dest='getdir',
                      help='download url to directory GETDIR')
    parser.add_option('-f', '--ftp', dest='ftpdir',
                      help='use ftp client to download into directory FTPDIR')
    parser.add_option('-i', '--midrelax', action='store_true',
                      help='choose from undeclared message-ids '
                           '(false positives probable)')
    parser.add_option('-l', '--local', action='store_true',
                      help='search for chosen message only locally')
    parser.add_option('-B', '--browse', action='store_true',
                      help='view chosen message at google groups with browser')
    parser.add_option('-n', '--news', action='store_true',
                      help='news only: do not search local mailboxes')
    parser.add_option('-m', '--mbox', dest='kiosk',
                      help='append message chosen by id to mbox KIOSK')
    parser.add_option('-d', '--dirs', dest='mhiers',
                      help='search for message in directories MHIERS '
                           '(colon-separated list, including mail spool)')
    parser.add_option('-D', '--specdirs',
                      help='search for message in directories SPECDIRS '
                           '(colon-separated list, excluding mail spool)')
    parser.add_option('-M', '--mask',
                      help='exclude mailboxes matching MASK from search')
    parser.add_option('-t', '--text', action='store_true',
                      help='treat input as text '
                           '(do not autodetect message or mailbox)')

    options, args = parser.parse_args()
    del parser

    try:
        u = urlpager.urlpager(options.__dict__, args)
        u.urlselect()
    except (util.DeadMan, IOError, KeyboardInterrupt), inst:
        sys.exit(inst)
Beispiel #5
0
def run():
    '''Runs the pybrowser script.'''
    parser = optparse.OptionParser(usage='%prog [option] [urls]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(app=None)
    parser.add_option('-b', '--browser', dest='app',
                      help='prefer browser APP over $BROWSER environment')
    options, args = parser.parse_args()
    del parser

    try:
        b = pybrowser.browser(items=args, app=options.app, evalurl=True)
        b.urlvisit()
    except util.DeadMan, inst:
        sys.exit(inst)
Beispiel #6
0
def run():
    '''Command interface to the Wrap class.'''
    parser = optparse.OptionParser(usage='%prog [options] [files]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(width=0, ipar=0, respect=0, hyph=False,
                        tabwidth=8, excl='', quote='',
                        qmail=False, email=False, _outfunc=False)

    parser.add_option('-w', '--width', type='int',
                      help='wrap lines to width WIDTH')
    parser.add_option('-i', '--ipar', type='int',
                      help='wrap to width IPAR '
                           'with each indent change starting a paragraph')
    parser.add_option('-r', '--respect', type='int',
                      help='wrap respecting linebreaks to width RESPECT')
    parser.add_option('-H', '--hyph', action='store_true',
                      help='break hyphen-compounded words when wrapping')
    parser.add_option('-t', '--tabwidth', type='int',
                      help='expand tabs to TABWIDTH spaces')
    parser.add_option('-e', '--excl',
                      help='exclude lines matching regex EXCL, '
                           'anchored at start of line, after quote removal')
    parser.add_option('-E', dest='excl',
                      action='store_const', const='[\s>|%:\-]',
                      help='exclude lines starting with space, '
                           '">", "|", "%", ":", "-"')
    parser.add_option('-q', '--quote',
                      help='treat character(s) of '
                           'string QUOTE as quote char(s)')
    parser.add_option('-m', '--email', action='store_true',
                      help='treat input as email message: '
                           'skip headers, unmangle >From')
    parser.add_option('-M', dest='qmail', action='store_true',
                      help='treat input as email message and ">" '
                           'as (additional) quote char')

    options, args = parser.parse_args()
    del parser

    try:
        w = wrap.wrap(options.__dict__, args)
        w.formwrap()
        sys.stdout.writelines(w.olines)
    except (util.DeadMan, IOError, KeyboardInterrupt) as inst:
        sys.exit(inst)
Beispiel #7
0
def run():
    '''Runs the pybrowser script.'''
    parser = optparse.OptionParser(usage='%prog [option] [urls]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(app=None)
    parser.add_option('-b',
                      '--browser',
                      dest='app',
                      help='prefer browser APP over $BROWSER environment')
    options, args = parser.parse_args()
    del parser

    try:
        b = pybrowser.browser(items=args, app=options.app, evalurl=True)
        b.urlvisit()
    except util.DeadMan, inst:
        sys.exit(inst)
Beispiel #8
0
def run():
    '''Runs the viewhtmlmsg script.'''
    parser = optparse.OptionParser(usage='%prog [options]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(safe=False, keep=None, app=None)
    parser.add_option('-s', '--safe', action='store_true',
                      help='view html w/o loading remote files')
    parser.add_option('-k', '--keep', type='int',
                      help='remove temporary files after KEEP seconds '
                           '(0 for keeping files)')
    parser.add_option('-b', '--browser', dest='app',
                      help='prefer browser APP over $BROWSER environment')

    options, args = parser.parse_args()
    del parser

    try:
        v = viewhtmlmsg.viewhtml(options.safe, options.keep, options.app, args)
        v.view()
    except (util.DeadMan, IOError, KeyboardInterrupt), inst:
        sys.exit(inst)
Beispiel #9
0
def run():
    '''Runs the urlbatcher script.'''
    parser = optparse.OptionParser(formatter=optparse.TitledHelpFormatter(),
                                   usage='%prog [options] [files]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(proto='web',
                        pat=None,
                        app=None,
                        getdir='',
                        midrelax=False,
                        local=False,
                        browse=False,
                        news=False,
                        kiosk='',
                        mhiers=None,
                        specdirs=None,
                        mask=None)

    parser.add_option('-p',
                      '--protocol',
                      dest='proto',
                      type='choice',
                      choices=valid_protos,
                      help='narrow down url choice to protocol PROTO')
    parser.add_option('-r',
                      '--regex',
                      dest='pat',
                      help='narrow down url choice to urls matching PAT')
    parser.add_option('-b',
                      '--browser',
                      dest='app',
                      help='prefer browser APP over $BROWSER environment')
    parser.add_option('-w',
                      '--wget',
                      dest='getdir',
                      help='download urls to directory GETDIR')
    parser.add_option('-i',
                      '--midrelax',
                      action='store_true',
                      help='choose from undeclared message-ids '
                      '(false positives probable)')
    parser.add_option('-l',
                      '--local',
                      action='store_true',
                      help='search for messages only locally')
    parser.add_option('-B',
                      '--browse',
                      action='store_true',
                      help='view messages at google groups with browser')
    parser.add_option('-n',
                      '--news',
                      action='store_true',
                      help='news only: do not search local mailboxes')
    parser.add_option('-m',
                      '--mbox',
                      dest='kiosk',
                      help='append messages to mbox KIOSK')
    parser.add_option('-d',
                      '--dirs',
                      dest='mhiers',
                      help='search for messages in directories MHIERS '
                      '(colon-separated list, including mail spool)')
    parser.add_option('-D',
                      '--specdirs',
                      help='search for messages in directories SPECDIRS '
                      '(colon-separated list, excluding mail spool)')
    parser.add_option('-M',
                      '--mask',
                      help='exclude mailboxes matching MASK from search')
    parser.add_option('-t',
                      '--text',
                      action='store_true',
                      help='treat input as text '
                      '(do not autodetect message or mailbox)')

    options, args = parser.parse_args()
    del parser

    try:
        u = urlbatcher.urlbatcher(options.__dict__, args)
        u.urlsearch()
    except (util.DeadMan, IOError, KeyboardInterrupt), inst:
        sys.exit(inst)
Beispiel #10
0
def run():
    '''Command interface to the Wrap class.'''
    parser = optparse.OptionParser(usage='%prog [options] [files]',
                                   description=__doc__,
                                   version=util.fullversion(proginfo))
    parser.set_defaults(width=0,
                        ipar=0,
                        respect=0,
                        hyph=False,
                        tabwidth=8,
                        excl='',
                        quote='',
                        qmail=False,
                        email=False,
                        _outfunc=False)

    parser.add_option('-w',
                      '--width',
                      type='int',
                      help='wrap lines to width WIDTH')
    parser.add_option('-i',
                      '--ipar',
                      type='int',
                      help='wrap to width IPAR '
                      'with each indent change starting a paragraph')
    parser.add_option('-r',
                      '--respect',
                      type='int',
                      help='wrap respecting linebreaks to width RESPECT')
    parser.add_option('-H',
                      '--hyph',
                      action='store_true',
                      help='break hyphen-compounded words when wrapping')
    parser.add_option('-t',
                      '--tabwidth',
                      type='int',
                      help='expand tabs to TABWIDTH spaces')
    parser.add_option('-e',
                      '--excl',
                      help='exclude lines matching regex EXCL, '
                      'anchored at start of line, after quote removal')
    parser.add_option('-E',
                      dest='excl',
                      action='store_const',
                      const='[\s>|%:\-]',
                      help='exclude lines starting with space, '
                      '">", "|", "%", ":", "-"')
    parser.add_option('-q',
                      '--quote',
                      help='treat character(s) of '
                      'string QUOTE as quote char(s)')
    parser.add_option('-m',
                      '--email',
                      action='store_true',
                      help='treat input as email message: '
                      'skip headers, unmangle >From')
    parser.add_option('-M',
                      dest='qmail',
                      action='store_true',
                      help='treat input as email message and ">" '
                      'as (additional) quote char')

    options, args = parser.parse_args()
    del parser

    try:
        w = wrap.wrap(options.__dict__, args)
        w.formwrap()
        sys.stdout.writelines(w.olines)
    except (util.DeadMan, IOError, KeyboardInterrupt), inst:
        sys.exit(inst)