예제 #1
0
def main():
    l18n.init()

    parser = ArghParser()
    parser.add_argument('-a', '--auth',
                        action='store_true',
                        help=_('Authenticate and show all problems'
                               ' on this machine'))

    parser.add_argument('-v', '--version',
                        action='version',
                        version=config.VERSION)

    parser.add_commands([
        backtrace,
        di_install,
        gdb,
        info,
        list_problems,
        remove,
        report,
        retrace,
        status,
    ])

    argcomplete.autocomplete(parser)

    try:
        parser.dispatch()
    except KeyboardInterrupt:
        sys.exit(1)

    sys.exit(0)
예제 #2
0
파일: tab_util.py 프로젝트: andreyto/mgtaxa
def main():
    logging_config(detail="high")
    parser = ArghParser(description="Utilities for working with tabular files")
    parser.add_commands([
        filter_rows
        ]
        )
    parser.dispatch()
예제 #3
0
def main():
    logging_config(detail="high")
    parser = ArghParser(description="Utilities for manipulating FASTA files")
    parser.add_commands([
        rec_filter
        ]
        )
    parser.dispatch()
예제 #4
0
def main():
    """Use argh to dispatch to your subcommands."""
    from argh import ArghParser  # sudo apt-get install python3-argh
    parser = ArghParser()
    # Sorting makes the output of --help better:
    parser.add_commands(sorted(subcommand.s, key=lambda f: f.__name__))
    # parser.add_commands(subcommand.s)
    parser.dispatch()
예제 #5
0
파일: mothur_edit.py 프로젝트: andreyto/YAP
def main():
    logging_helper.logging_config(detail="high")
    parser = ArghParser()
    parser.add_commands([
        remove_missing_seqs
        ]
        )
    parser.dispatch()
예제 #6
0
파일: conv.py 프로젝트: jvtm/sslkml
def main(argv=None):
    """ Main method / entry point """
    if argv is None:
        argv = sys.argv[1:]
    description = "SSL Karttarekisteri KML tool"
    parser = ArghParser(description=description)
    parser.add_commands([convert, download])
    parser.dispatch(argv=argv)
예제 #7
0
def main():
    logging_config(detail="high")
    parser = ArghParser(description="Utilities for analysing output of annotation consensus classifier")
    parser.add_commands([
        as_tab
        ]
        )
    parser.dispatch()
예제 #8
0
    def __call__(self, **kwargs):
        parser = ArghParser()
        commands = [
            full_release,
            publish_cfg_files,
            update_distribution_changelog,
        ]

        parser.add_commands(commands)
        parser.dispatch()
예제 #9
0
파일: ctl.py 프로젝트: baloon11/npui
def main():
	parser = ArghParser()

	parser.add_commands(
		(
			module_list,
			module_install,
			module_uninstall,
			module_enable,
			module_disable
		),
		namespace='module',
		title='Module commands',
		description='Group of commands related to listing or (un)installing modules'
	)

	ini_file='production.ini'
	if 'NP_INI_FILE' in os.environ:
		ini_file = os.environ['NP_INI_FILE']

	ini_name='netprofile'
	if 'NP_INI_NAME' in os.environ:
		ini_name = os.environ['NP_INI_NAME']

	parser.add_argument('--ini-file', '-i', default=ini_file, help='Specify .ini file to use')
	parser.add_argument('--application', '-a', default=ini_name, help='Default app section of .ini file to use')

	parser.dispatch()
예제 #10
0
 def __call__(self, **kwargs):
     parser = ArghParser()
     parser.add_commands(
         [checkPypi,
          checkPackageForUpdates,
          checkAllPackagesForUpdates,
          pulls,
          changelog,
          create_launchpad_release,
          check_checkout])
     parser.dispatch()
예제 #11
0
def main():
    """Shell entry point for execution"""
    try:
        argparser = ArghParser()
        argparser.add_commands([
            phase1_install,
            phase2_install,
        ])

        argparser.dispatch()
    except KeyboardInterrupt:
        sys.exit(0)
예제 #12
0
 def __call__(self, **kwargs):
     parser = ArghParser()
     parser.add_commands(
         [checkPypi,
          checkPackageForUpdates,
          checkAllPackagesForUpdates,
          pulls,
          changelog,
          create_launchpad_release,
          check_checkout,
          append_jenkins_build_number_to_package_version])
     parser.dispatch()
예제 #13
0
def main():
    hc.setup()

    opt = "stdin_buffer_lines"
    buffer = 0
    buffering = False

    #if opt in CONFIG:
    #    buffering = True
    #    buffer = int(CONFIG[opt])

    if not sys.stdin.isatty():
        db = get_database()
        cbuffer = 0
        # FIXME: should handle g-code & stuff
        while True:
            line = sys.stdin.readline()
            if not line:
                break

            path, value = line.split(' ', 1)
            if ' ' in value:  # timestamp present
                dt_in, value = value.split()
                dt = parse_timestamp(dt_in)
            else:
                dt = now()
            #print(o)
            cbuffer += 1

        sys.exit(0)

    #logging.basicConfig(level=logging.DEBUG)
    #logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
    logging.basicConfig(level=logging.INFO)

    parser = ArghParser()
    parser.add_commands([
        send,
        shell,
        server,
        monitor,
        uimon,
        uipcb,
        uiprobe,
    ])

    argcomplete.autocomplete(parser)

    try:
        parser.dispatch()
    except KeyboardInterrupt:
        sys.exit(1)
예제 #14
0
파일: __init__.py 프로젝트: pior/awstools
def get_base_parser():
    dist = pkg_resources.get_distribution("awstools")
    parser = ArghParser(version=dist.version)
    parser.add_argument(
        '--config',
        default=None,
        help="path of an alternative configuration file")
    parser.add_argument(
        '--settings',
        default=None,
        help="path of the application settings configuration file")

    return parser
예제 #15
0
파일: shell.py 프로젝트: samstav/hot
def main():
    """Shell entry point for execution"""
    try:
        argparser = ArghParser()
        argparser.add_commands([
            do_template_test,
            do_create_docs,
            do_template_init,
        ])

        argparser.dispatch()
    except KeyboardInterrupt:
        sys.exit(0)
예제 #16
0
def main():
    parser = ArghParser(description='Simple static gallery generator.')
    parser.add_commands([init, build, serve])
    parser.add_argument('--version',
                        action='version',
                        version='%(prog)s {}'.format(__version__))
    parser.dispatch()
예제 #17
0
파일: __init__.py 프로젝트: garbas/git-spy
def main():
    config_file = os.environ.get('GIT_SPY', '~/.gitspy')
    if os.environ.has_key('HOME'):
        config_file = config_file.replace('~', os.environ.get('HOME'))
    if not os.path.exists(config_file):
        config_fp = open(config_file, 'w+')
    else:
        config_fp = open(config_file, 'r')

    commands = Commands(config_fp)

    parser = ArghParser()
    parser.add_commands(commands)
    parser.dispatch()
    config_fp.close()
예제 #18
0
def main():
    parser = ArghParser()
    parser.add_argument('-v',
                        '--version',
                        action='version',
                        version=__version__)
    enabled_commands = [init, build, watch, po, runserver]

    parser.add_commands(enabled_commands)
    parser.dispatch()
예제 #19
0
def main():
    reload(sys)
    sys.setdefaultencoding("utf-8")

    parser = ArghParser(description='Simple static gallery generator.')
    parser.add_commands([init, build, serve])
    parser.add_argument('--version',
                        action='version',
                        version='%(prog)s {}'.format(__version__))
    parser.dispatch()
예제 #20
0
def main():
    commands = pack, watch, shell, libs
    names = [f.__name__ for f in commands] + [ 'help' ]

    parser = ArghParser()
    parser.add_argument('-v', '--version', action='version', version=VERSION, help='Show zeta version')
    parser.add_commands(commands)
    argv = sys.argv[1:]
    if argv and not argv[0] in names and not argv[0] in ['-v', '--version']:
        argv.insert(0, 'pack')
    parser.dispatch(argv)
예제 #21
0
파일: __init__.py 프로젝트: Galland/sigal
def main():
    reload(sys)
    sys.setdefaultencoding("utf-8")
    
    parser = ArghParser(description='Simple static gallery generator.')
    parser.add_commands([init, build, serve])
    parser.add_argument('--version', action='version',
                        version='%(prog)s {}'.format(__version__))
    parser.dispatch()
예제 #22
0
def test_register_commands_quiet_and_verbose_together_systemexit(monkeypatch):
    """Test that register_commands with quiet and verbose raises SystemExit."""
    monkeypatch.setattr(cli, 'parser', ArghParser('testing'))

    def verbosity(quiet, verbose):
        pass

    cli.register_commands('testing', [verbosity])

    with pytest.raises(SystemExit):
        cli.parser.parse_args(['testing', 'verbosity', '-q', '-v'])
예제 #23
0
def test_register_commands_verbose(monkeypatch, arguments, expected):
    """Test that register_commands handles quiet."""
    monkeypatch.setattr(cli, 'parser', ArghParser('testing'))

    def verbosity(verbose):
        pass

    cli.register_commands('testing', [verbosity])

    args = cli.parser.parse_args(['testing', 'verbosity'] + arguments)
    assert args.verbose == expected
예제 #24
0
def main():
    """
    Main entrypoint for console_script (commandline script)
    """
    parser = ArghParser()
    parser.add_argument('-v',
                        '--version',
                        action='version',
                        version=client_version)
    enabled_commands = [register]

    parser.add_commands(enabled_commands)
    parser.dispatch()
예제 #25
0
def test_register_commands_keyword_only_conflicts(monkeypatch):
    """Test register_commands with key-only arguments with conflicts."""
    monkeypatch.setattr(cli, 'parser', ArghParser('testing'))

    def keyword(*, arg1=1, arg2=2):
        pass

    cli.register_commands('testing', [keyword])

    with pytest.raises(SystemExit):
        cli.parser.parse_args(['testing', 'keyword', '-a', '1'])
예제 #26
0
def test_register_commands(monkeypatch):
    """Test register_commands with no arguments."""
    monkeypatch.setattr(cli, 'parser', ArghParser('testing'))

    def simple():
        pass

    cli.register_commands('testing', [simple])

    args = cli.parser.parse_args(['testing', 'simple'])
    assert args
예제 #27
0
def test_register_commands_keyword(monkeypatch, arguments, a, b):
    """Test register_commands with keyword arguments."""
    monkeypatch.setattr(cli, 'parser', ArghParser('testing'))

    def keyword(a=1, b=2):
        pass

    cli.register_commands('testing', [keyword])

    args = cli.parser.parse_args(['testing', 'keyword'] + arguments)
    assert args.a == a
    assert args.b == b
예제 #28
0
def test_register_commands_positional(monkeypatch):
    """Test register_commands with positional arguments."""
    monkeypatch.setattr(cli, 'parser', ArghParser('testing'))

    def positional(a, b):
        pass

    cli.register_commands('testing', [positional])

    args = cli.parser.parse_args(['testing', 'positional', '1', '2'])
    assert args.a == '1'
    assert args.b == '2'
예제 #29
0
def main():
    """
    Main entrypoint for console_script (commandline script)
    """
    parser = ArghParser()
    parser.add_argument('-v', '--version', action='version', version=client_version)
    enabled_commands = [pull, push]
    
    parser.add_commands(enabled_commands)
    parser.dispatch()
예제 #30
0
def main():
    """
    Main entrypoint for console_script (commandline script)
    """
    parser = ArghParser()
    parser.add_argument("-v", "--version", action="version", version=client_version)
    enabled_commands = [register]

    parser.add_commands(enabled_commands)
    parser.dispatch()
예제 #31
0
def test_register_commands_keyword_only(monkeypatch, arguments, first, second):
    """Test register_commands with keyword-only arguments."""
    monkeypatch.setattr(cli, 'parser', ArghParser('testing'))

    def keyword(*, first=1, second=2):
        pass

    cli.register_commands('testing', [keyword])

    args = cli.parser.parse_args(['testing', 'keyword'] + arguments)
    assert args.first == first
    assert args.second == second
예제 #32
0
def vast_ai():
    functionality = [
        VastAPI.create_account, VastAPI.set_api_key, VastAPI.login
    ]
    p = ArghParser()
    p.add_commands(functionality)
    p.dispatch()
예제 #33
0
파일: odel.py 프로젝트: nithinphilips/odel
def main():
    """Main application entrypoint"""
    parser = ArghParser(parents=[COMMON_PARSER])
    set_default_command(parser, upload)
    completion.autocomplete(parser)

    # Peek CLI arguments and globally enable debugging
    args = parser.parse_args()
    if args.debug:
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s %(levelname)s: %(message)s'
        )

        # Cut down suds logs
        logging.getLogger('suds').setLevel(logging.WARNING)

    if args.version:
        print_version()
        return

    parser.dispatch()
예제 #34
0
def test_register_commands_quiet_and_verbose(monkeypatch, arguments, quiet,
                                             verbose):
    """Test that register_commands handles quiet and verbose."""
    monkeypatch.setattr(cli, 'parser', ArghParser('testing'))

    def verbosity(quiet, verbose):
        pass

    cli.register_commands('testing', [verbosity])

    args = cli.parser.parse_args(['testing', 'verbosity', arguments])
    assert args.quiet == quiet
    assert args.verbose == verbose
예제 #35
0
def eventparser_entry():
    parser = ArghParser(parents=[COMMON_PARSER])
    parser.set_default_command(eventparser)
    completion.autocomplete(parser)

    # Parse ahead
    args = parser.parse_args()
    if args.debug:
        logging.basicConfig(level=logging.DEBUG,
                            format='%(asctime)s %(levelname)s: %(message)s')

    parser.dispatch()
예제 #36
0
파일: main.py 프로젝트: mwicat/gitanal
def main():
    parser = ArghParser(description=__doc__)
    parser.add_commands([report, me])
    try:
        parser.dispatch()
    except Exception as e:
        raise
        logger.error('Runtime exception: %s' % e)
        sys.exit(1)
예제 #37
0
파일: cli.py 프로젝트: jfilak/abrt
def main():
    l18n.init()

    parser = ArghParser()
    parser.add_argument(
        "-a", "--auth", action="store_true", help=_("Authenticate and show all problems" " on this machine")
    )

    parser.add_argument("-v", "--version", action="version", version=config.VERSION)

    parser.add_commands([backtrace, di_install, gdb, info, list_problems, remove, report, retrace, status])

    argcomplete.autocomplete(parser)

    try:
        parser.dispatch()
    except KeyboardInterrupt:
        sys.exit(1)

    sys.exit(0)
예제 #38
0
def main():
    from snaptastic import __version__
    if '--version' in sys.argv:
        print 'Snaptastic version %s' % __version__

    p = ArghParser()
    commands = [make_snapshots, mount_snapshots, check_backups,
                list_volumes, unmount_snapshots, clean, test]
    p.add_commands(commands)
    p.dispatch()
예제 #39
0
def __main__():
    parser = ArghParser()
    parser.add_commands(
        sorted([
            v for k, v in globals().items()
            if not k.startswith("_") and not k == "main" and isfunction(v)
            and v.__module__ == "__main__"
        ],
               key=lambda a: a.__name__))
    parser.dispatch()
예제 #40
0
def get_base_parser():
    dist = pkg_resources.get_distribution("awstools")
    parser = ArghParser(version=dist.version)
    parser.add_argument('--config',
                        default=None,
                        help="path of an alternative configuration file")
    parser.add_argument(
        '--settings',
        default=None,
        help="path of the application settings configuration file")

    return parser
예제 #41
0
def main():
    parser = ArghParser()
    parser.add_argument('-v', '--version', action='version', version=__version__)
    enabled_commands = [init, build, watch, po]
    
    # Enabling runserver command if cherrypy is installed
    try:
        import cherrypy
    except ImportError:
        pass
    else:
        from optimus.cli.runserver import runserver
        enabled_commands.append(runserver)
    
    parser.add_commands(enabled_commands)
    parser.dispatch()
예제 #42
0
def main():
    """
    Main entrypoint for the application. Parses the command-line arguments the
    dispatches the correct methods.
    """
    parser = ArghParser(parents=[COMMON_PARSER])
    parser.add_commands(
        [exporttracks, checktoken, allaccessimport, exportplaylist])

    args = parser.parse_args()

    if args.debug:
        logging.basicConfig(level=logging.DEBUG,
                            format='%(asctime)s %(levelname)s: %(message)s')

    parser.dispatch()
예제 #43
0
 def __call__(self, **kwargs):
     parser = ArghParser()
     parser.add_commands(
         [checkPypi,
          checkPackageForUpdates,
          checkAllPackagesForUpdates,
          pulls,
          changelog,
          create_launchpad_release,
          check_checkout,
          append_jenkins_build_number_to_package_version,
          set_package_version])
     parser.dispatch()
예제 #44
0
def vast():
    vast = VastAPI()

    functionality = [
        vast.change_bid, vast.create_instance, vast.destroy_instance,
        vast.label_instance, vast.list_machine, vast.remove_defjob,
        vast.set_defjob, vast.set_min_bid, vast.show_instances,
        vast.show_machines, vast.start_instance, vast.stop_instance,
        vast.unlist_machine, vast.search_offers
    ]
    p = ArghParser()
    p.add_commands(functionality)
    p.dispatch()
예제 #45
0
파일: shell.py 프로젝트: JasonBoyles/hot
def main():
    """Shell entry point for execution"""
    try:
        argparser = ArghParser()
        argparser.add_commands([
            test,
            docs,
            init,
            lint,
        ])

        argparser.dispatch()
    except KeyboardInterrupt:
        sys.exit(0)
예제 #46
0
def eventparser_entry():
    parser = ArghParser(parents=[COMMON_PARSER])
    parser.set_default_command(eventparser)
    completion.autocomplete(parser)

    # Parse ahead
    args = parser.parse_args()
    if args.debug:
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s %(levelname)s: %(message)s'
        )

    parser.dispatch()
예제 #47
0
def main():
    logging_config(detail="high")
    parser = ArghParser()
    ref_down = RefseqDownloader()
    parser.add_commands([
        ref_down.checkout
        ]
        )
    parser.add_commands([
        ref_down.list_remote_files,
        ref_down.download_file,
        ref_down.wf_generate,
        ref_down.extract_fasta_header
        ],
        namespace="internal",
        title="Commands used internally by the application"
        )
    parser.dispatch()
예제 #48
0
파일: vx.py 프로젝트: fish2000/Praxa
def main(*argv):
    resources.init("Praxa", getenv('INSTANCE_NAME', "Praxa"))
    if not isdir(resources.user.path):
        makedirs(resources.user.path)
    
    arguments = list(argv)
    if not arguments:
        from sys import argv
        arguments = argv[1:]
    
    parser = ArghParser()
    parser.add_help = True
    parser.add_commands([dump, load], namespace="env",
        title="Environment Manipulation")
    parser.add_commands([vexec]) # the default
    
    if len(arguments):
        if arguments[0] not in ('env', 'dump', 'load', 'exec'):
            arguments.insert(0, 'exec')
    
    parser.dispatch(argv=arguments)
    return 0
예제 #49
0
def main():
    opt = "stdin_buffer_lines"
    buffer = 0
    buffering = False

    #if opt in CONFIG:
    #    buffering = True
    #    buffer = int(CONFIG[opt])

    if not sys.stdin.isatty():
        db = get_database()
        cbuffer = 0
        # FIXME: should handle g-code & stuff
        while True:
            line = sys.stdin.readline()
            if not line:
                break

            path, value = line.split(' ', 1)
            if ' ' in value:  # timestamp present
                dt_in, value = value.split()
                dt = parse_timestamp(dt_in)
            else:
                dt = now()
            #print(o)
            cbuffer += 1

        sys.exit(0)

    #logging.basicConfig(level=logging.DEBUG)
    #logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
    logging.basicConfig(level=logging.INFO)

    parser = ArghParser()
    parser.add_commands([
        shell,
        monitor,
        uimon,
        uipcb,
        uiprobe,
    ])

    argcomplete.autocomplete(parser)

    try:
        parser.dispatch()
    except KeyboardInterrupt:
        sys.exit(1)
def main():
    parser = ArghParser(parents=[COMMON_PARSER])
    parser.add_commands(
        [
            ting
        ]
    )
    completion.autocomplete(parser)

    # Parse ahead
    args = parser.parse_args()
    if args.debug:
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s %(levelname)s: %(message)s'
        )

    parser.dispatch()
예제 #51
0
def main():
    """
    Main entrypoint for the application. Parses the command-line arguments the
    dispatches the correct methods.
    """
    parser = ArghParser(parents=[COMMON_PARSER])
    parser.add_commands(
        [
            exporttracks, checktoken,
            allaccessimport, exportplaylist
        ]
    )

    args = parser.parse_args()

    if args.debug:
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s %(levelname)s: %(message)s'
        )

    parser.dispatch()
예제 #52
0
파일: snip.py 프로젝트: TM-KUNGFOOO/snip
#!/usr/bin/python3
__author__ = 'meatpuppet'

import logging
from argh import ArghParser
from snip import terminal
from argh.completion import autocomplete

# todo: incremental indexing https://whoosh.readthedocs.org/en/latest/indexing.html


def web():
    from snip.web import web
    import webbrowser
    webbrowser.open('http://localhost:5000')
    web.app.run()


if __name__ == "__main__":
    parser = ArghParser()
    parser.add_commands([terminal.pull, terminal.show, terminal.search, terminal.index, web])
    autocomplete(parser)
    parser.dispatch()



예제 #53
0
                 remote_user=default_remote_user,
                 region=default_region,
                 remote_control_dir=default_remote_control_dir):
    master = master or get_master(cluster_name, region=region)
    ssh_call(user=remote_user,
             host=master,
             key_file=key_file,
             args=[
                 '''for i in {remote_control_dir}/*/RUNNING; do
                pid=$(cat $i)
                children=$(pgrep -P $pid)
                sudo kill $pid $children || true
            done >& /dev/null || true'''.format(
                     remote_control_dir=remote_control_dir)
             ])


parser = ArghParser()
parser.add_commands([
    launch, destroy, get_master, ssh_master, tag_cluster_instances,
    health_check
])
parser.add_commands([
    job_run, job_attach, wait_for_job, kill_job, killall_jobs,
    collect_job_results
],
                    namespace="jobs")

if __name__ == '__main__':
    parser.dispatch()
예제 #54
0
                             ignore_directories=args.ignore_directories,
                             stop_signal=stop_signal,
                             kill_after=args.kill_after)
  handler.start()
  observer = Observer(timeout=args.timeout)
  observe_with(observer, handler, args.directories, args.recursive)
  handler.stop()


epilog = """Copyright 2011 Yesudeep Mangalapilly <*****@*****.**>.
Copyright 2012 Google, Inc.

Licensed under the terms of the Apache license, version 2.0. Please see
LICENSE in the source code for more information."""

parser = ArghParser(epilog=epilog)
parser.add_commands([tricks_from,
                     tricks_generate_yaml,
                     log,
                     shell_command,
                     auto_restart])
parser.add_argument('--version',
                    action='version',
                    version='%(prog)s ' + VERSION_STRING)


def main():
  """Entry-point function."""
  parser.dispatch()

예제 #55
0
파일: cli.py 프로젝트: aouyar/pgbarman-code
def main():
    ''' The main method of Barman '''
    p = ArghParser()
    p.add_argument('-v',
                   '--version',
                   action='version',
                   version=barman.__version__)
    p.add_argument(
        '-c',
        '--config',
        help=
        'uses a configuration file (defaults: $HOME/.barman.conf, /etc/barman.conf)'
    )
    p.add_argument('-q', '--quiet', help='be quiet', action='store_true')
    p.add_commands([
        cron,
        list_server,
        show_server,
        status,
        check,
        backup,
        list_backup,
        show_backup,
        list_files,
        recover,
        delete,
    ])
    try:
        p.dispatch(pre_call=global_config, output_file=_output_stream)
    except Exception:
        msg = "ERROR: Unhandled exception. See log file for more details."
        logging.exception(msg)
        raise SystemExit(msg)
예제 #56
0
파일: cli.py 프로젝트: secwall/barman
def main():
    """
    The main method of Barman
    """
    p = ArghParser(epilog='Barman by 2ndQuadrant (www.2ndQuadrant.com)')
    p.add_argument(
        '-v',
        '--version',
        action='version',
        version='%s\n\nBarman by 2ndQuadrant (www.2ndQuadrant.com)' %
        barman.__version__)
    p.add_argument('-c',
                   '--config',
                   help='uses a configuration file '
                   '(defaults: %s)' %
                   ', '.join(barman.config.Config.CONFIG_FILES),
                   default=SUPPRESS)
    p.add_argument('-q', '--quiet', help='be quiet', action='store_true')
    p.add_argument('-d', '--debug', help='debug output', action='store_true')
    p.add_argument('-f',
                   '--format',
                   help='output format',
                   choices=output.AVAILABLE_WRITERS.keys(),
                   default=output.DEFAULT_WRITER)
    p.add_commands([
        archive_wal,
        backup,
        check,
        cron,
        delete,
        diagnose,
        get_wal,
        list_backup,
        list_files,
        list_server,
        rebuild_xlogdb,
        receive_wal,
        recover,
        show_backup,
        show_server,
        replication_status,
        status,
        switch_xlog,
    ])
    # noinspection PyBroadException
    try:
        p.dispatch(pre_call=global_config)
    except KeyboardInterrupt:
        msg = "Process interrupted by user (KeyboardInterrupt)"
        output.error(msg)
    except Exception as e:
        msg = "%s\nSee log file for more details." % e
        output.exception(msg)

    # cleanup output API and exit honoring output.error_occurred and
    # output.error_exit_code
    output.close_and_exit()
예제 #57
0
def main():
    from argh import ArghParser
    parser = ArghParser()
    parser.add_commands([to_jbrowse])
    parser.dispatch()