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, check_backup, cron, delete, diagnose, get_wal, list_backup, list_files, list_server, put_wal, rebuild_xlogdb, receive_wal, recover, show_backup, show_server, replication_status, status, switch_wal, 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()
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)
def vast_ai(): functionality = [ VastAPI.create_account, VastAPI.set_api_key, VastAPI.login ] p = ArghParser() p.add_commands(functionality) p.dispatch()
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)
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()
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()
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)
def main(): logging_config(detail="high") parser = ArghParser(description="Utilities for analysing output of annotation consensus classifier") parser.add_commands([ as_tab ] ) parser.dispatch()
def main(): logging_config(detail="high") parser = ArghParser(description="Utilities for manipulating FASTA files") parser.add_commands([ rec_filter ] ) parser.dispatch()
def main(): logging_config(detail="high") parser = ArghParser(description="Utilities for working with tabular files") parser.add_commands([ filter_rows ] ) parser.dispatch()
def main(): logging_helper.logging_config(detail="high") parser = ArghParser() parser.add_commands([ remove_missing_seqs ] ) parser.dispatch()
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()
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)
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()
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)
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()
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()
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()
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()
def __call__(self, **kwargs): parser = ArghParser() commands = [ full_release, publish_cfg_files, update_distribution_changelog, ] parser.add_commands(commands) parser.dispatch()
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()
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)
def __call__(self, **kwargs): parser = ArghParser() parser.add_commands( [checkPypi, checkPackageForUpdates, checkAllPackagesForUpdates, pulls, changelog, create_launchpad_release, check_checkout]) parser.dispatch()
def main(): """Shell entry point for execution""" try: argparser = ArghParser() argparser.add_commands([ phase1_install, phase2_install, ]) argparser.dispatch() except KeyboardInterrupt: sys.exit(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()
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()
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)
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()
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)
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()
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()
def main(): """Shell entry point for execution""" try: argparser = ArghParser() argparser.add_commands([ test, docs, init, lint, ]) argparser.dispatch() except KeyboardInterrupt: sys.exit(0)
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()
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() 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()
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()
def argh_main(progname, commands,default_verbosity=None, default_file_verbosity=None): default_verbosity=default_verbosity or "CRITICAL" default_file_verbosity=default_file_verbosity or "CRITICAL" parser = ArghParser() parser.add_argument("--very_verbose", action="store_true") parser.add_argument("--logfile",type=str, default="{0}.log".format(progname)) parser.add_argument("--verbosity","-v",type=str, default=default_verbosity) parser.add_argument("--file_verbosity","-fv",type=str, default=default_file_verbosity) parser.add_argument("--timing","-t", default=False, action='store_true') parser.add_argument("--args","-a", default=False, action='store_true') #mylog.command_line(parser, progname, default_verbosity="CRITICAL", default_file_verbosity="INFO") parser.add_commands(commands) args = parser.parse_args() log = mylog.default_logger(progname, logfile=args.logfile, verbosity=args.verbosity, file_verbosity=args.file_verbosity) if args.args: d=vars(args) log.info(",".join(["{0}={1}".format(k,v) for k,v in d.items()])) if args.timing: import datetime start = datetime.datetime.now() log.info("Start time: {0}".format(start)) try: parser.dispatch() if args.timing: import datetime end = datetime.datetime.now() log.info("End time: {0}".format(end)) log.info("Run time: {0}".format((end-start).total_seconds())) except KeyboardInterrupt as e: log.info("Exiting on Keyboard Interrupt") print("Exiting on Keyboard Interrupt") except Exception as e: print("ERROR: {0}".format(e)) log.error(e) if args.very_verbose: raise else: sys.exit(1)
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: %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, status, ] ) # noinspection PyBroadException try: p.dispatch(pre_call=global_config) except KeyboardInterrupt: msg = "Process interrupted by user (KeyboardInterrupt)" output.exception(msg) except Exception, e: msg = "%s\nSee log file for more details." % e output.exception(msg)
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: %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, cron, list_server, show_server, status, check, diagnose, backup, list_backup, show_backup, list_files, get_wal, recover, delete, rebuild_xlogdb, ] ) # noinspection PyBroadException try: p.dispatch(pre_call=global_config) except KeyboardInterrupt: msg = "Process interrupted by user (KeyboardInterrupt)" output.exception(msg) except Exception, e: msg = "%s\nSee log file for more details." % e output.exception(msg)
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()
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()
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)
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()
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
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() if __name__ == '__main__': main()
patterns, ignore_patterns = parse_patterns(args.patterns, args.ignore_patterns) handler = ShellCommandTrick(shell_command=args.command, patterns=patterns, ignore_patterns=ignore_patterns, ignore_directories=args.ignore_directories) observer = Observer(timeout=args.timeout) observe_with(observer, handler, args.directories, args.recursive) epilog = """Copyright (C) 2010 Gora Khargosh <*****@*****.**>. Licensed under the terms of the MIT license. 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]) parser.add_argument('--version', action='version', version='%(prog)s ' + VERSION_STRING) def main(): """Entry-point function.""" parser.dispatch() if __name__ == '__main__': main()
def main(): parser = ArghParser(description="Additional SuperSrg utilities") parser.add_commands([convert]) parser.dispatch()
df['cathode {}Current'.format(k)] *= -1 for band_before, bandk in [('h', 'VB'), ('e', 'CB'), ('Total', 'tot')]: for contact_before, contact_k in [('anode', 'p'), ('cathode', 'n')]: dfo['j_{}:{}_contact'.format( bandk, contact_k)] = J_SCALE * (df['{} {}Current'.format( contact_before, band_before)]) # clip to zero dfo['Vext'][dfo['Vext'].abs() < 1e-6] = 0.0 SPLIT = True if SPLIT: for sgn in [1, -1]: xdf = dfo[dfo['Vext'] * sgn >= 0].copy() xdf['_Vext_abs'] = dfo['Vext'].abs() xdf.sort_values('_Vext_abs', inplace=True) del xdf['_Vext_abs'] xdf.reset_index(drop=True, inplace=True) xdf.to_csv(input_file + '_' + ' pm'[sgn] + '.csv') else: # print(dfo) dfo.to_csv(input_file + '.csv') parser = ArghParser() parser.add_commands([convert]) if __name__ == '__main__': parser.dispatch()
username = raw_input("Splunk Username: "******"Splunk Password: "******"", force=True, username=username, password=password, ) for app in APPFX_DEFAULT_APPS: args.appname = app deploy(args) break except KeyboardInterrupt: print sys.exit(0) print "\nSplunk AppFx setup is complete -- enter 'appfx run' to start" parser = ArghParser() parser.add_commands([setup, run, test, clean, createapp, removeapp, deploy]) if __name__=='__main__': parser.dispatch()
def main(): from argh import ArghParser parser = ArghParser() parser.add_commands([to_jbrowse]) parser.dispatch()
""" wrapper = readadsr(adsrfile) sheet = readpart(partfile) sheet2wav(sheet, wrapper, wavfile, samplerate) def midi2wav(adsrfile, midifile, wavfile, samplerate=44100): """ create a wav file from adsr and midi """ wrapper = readadsr(adsrfile) sheet = readmidi(midifile) sheet2wav(sheet, wrapper, wavfile, samplerate) basecli.append(readpart) basecli.append(readmidi) basecli.append(part2wav) basecli.append(midi2wav) #endregion if __name__ == '__main__': from argh import ArghParser parser = ArghParser() parser.add_commands(basecli) parser.dispatch()
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()
""" if not debug: import logging file_handler = logging.FileHandler("error.log") file_handler.setLevel(logging.WARNING) app.logger.addHandler(file_handler) # asset_manager.config['ASSETS_DEBUG'] = debug app.debug = debug app.run(host=server, port=port, debug=debug) def prod(): serve(debug=False) if __name__ == "__main__": parser = ArghParser() parser.add_commands([serve, prod]) parser.dispatch() else: # App has been called from a WSGI server. import logging file_handler = logging.FileHandler("error.log") file_handler.setLevel(logging.WARNING) app.logger.addHandler(file_handler) # app.debug = True
if not file_name.endswith('.java'): file_name += ".java" try: errors = load_decompile_errors()[file_name] except KeyError: errors = [] print(f"Found {len(errors)} errors for {file_name}") for value in errors: print("ERROR: " + value) @arg('--quiet', help="Only print a message if files were restored") def restore_blacklisted(quiet=False): """Restore all blacklisted decompiled files""" decompiled_dir = Path(WORK_DIR, minecraft_version(), "decompiled", "net/minecraft/server") unmapped_dir = Path(WORK_DIR, "unmapped", "net/minecraft/server") num_restored = 0 if any(not Path(unmapped_dir, source.name).exists() for source in decompiled_dir.iterdir()): regenerate_unmapped_sources(respect_blacklist=False) if __name__ == "__main__": parser = ArghParser(prog="fountain.sh", description="TacoFountain utilities") parser.add_commands([ find_decompile_errors, restore_blacklisted, regenerate_blacklist, print_errors, generate_fixes ]) parser.dispatch()
from argh import ArghParser, dispatch from . import (client, gateway) parser = ArghParser(description='MassMesh CLI tool') parser.add_commands(client.cmd, namespace='cl', title='client configuration') parser.add_commands(gateway.cmd, namespace='gw', title='gateway configuration') def main(): try: dispatch(parser) except KeyboardInterrupt as e: pass if __name__ == '__main__': main()
#!/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()