Command line interface
507416
def main():
    """"""

    parser = argparse.ArgumentParser(description='Convert ULog to CSV')
    parser.add_argument('filename', metavar='file.ulg', help='ULog input file')

    parser.add_argument(
        '-m', '--messages', dest='messages',
        help=("Only consider given messages. Must be a comma-separated list of"
              " names, like 'sensor_combined,vehicle_gps_position'"))
    parser.add_argument('-d', '--delimiter', dest='delimiter', action='store',
                        help="Use delimiter in CSV (default is ',')", default=',')


    parser.add_argument('-o', '--output', dest='output', action='store',
                        help='Output directory (default is same as input file)',
                        metavar='DIR')

    args = parser.parse_args()

    if args.output and not os.path.isdir(args.output):
        print('Creating output directory {:}'.format(args.output))
        os.mkdir(args.output)

    convert_ulog2csv(args.filename, args.messages, args.output, args.delimiter)
65090
public static void main(String[] args) {

//		StdIODialog dialog = new StdIODialog(System.in, System.out, new CommandShell("cmd.exe", new File("C:\\")));
		StdIODialog dialog = new StdIODialog(System.in, System.out, new CommandShell(new String[]{"cmd.exe"}, new File("./")));
		try {
			dialog.open();
		}
		catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}
799184
def main(arguments=None):
    

    # setup the command-line util settings
    su = tools(
        arguments=arguments,
        docString=__doc__,
        logLevel="WARNING",
        options_first=False,
        projectName="fundmentals"
    )
    arguments, settings, log, dbConn = su.setup()

    # UNPACK REMAINING CL ARGUMENTS USING `EXEC` TO SETUP THE VARIABLE NAMES
    # AUTOMATICALLY
    for arg, val in arguments.iteritems():
        if arg[0] == "-":
            varname = arg.replace("-", "") + "Flag"
        else:
            varname = arg.replace("<", "").replace(">", "")
        if isinstance(val, str) or isinstance(val, unicode):
            exec(varname + " = '%s'" % (val,))
        else:
            exec(varname + " = %s" % (val,))
        if arg == "--dbConn":
            dbConn = val
        log.debug('%s = %s' % (varname, val,))

    if successFlag and successFlag.lower() == "none":
        successFlag = None
    if failureFlag and failureFlag.lower() == "none":
        failureFlag = None

    directory_script_runner(
        log=log,
        pathToScriptDirectory=pathToDirectory,
        databaseName=databaseName,
        loginPath=loginPath,
        successRule=successFlag,
        failureRule=failureFlag
    )

    return
226950
def main():
    
    about_str = "{} version: {}".format(PROJECT_NAME, VERSION)
    parser = argparse.ArgumentParser(description = about_str)

    parser.add_argument('fileNames', metavar='FILE', nargs='*', help='Input files')

    parser.add_argument('-i', '--inspector', dest='inspector',
        help="""The identifier or fullName of the inspector that will be opened at start up.
                E.g. 'Qt/Table'""")

    parser.add_argument('--list-inspectors', dest='list_inspectors', action = 'store_true',
        help="""Prints a list of available inspectors for the -i option""")


    parser.add_argument('-s', '--select', dest='selectPath',
        help="""Full path name of a repository tree item that will be selected at start-up.
                E.g. 'file/var/fieldname'""")

    parser.add_argument('-p', '--profile', dest='profile', default=DEFAULT_PROFILE,
        help="Can be used to have different persistent settings for different use cases.")

    parser.add_argument('--reset', '--reset-profile', dest='reset_profile', action = 'store_true',
        help="If set, persistent settings will be reset for the current profile.")

    parser.add_argument('--reset-all-profiles', dest='reset_all_profiles', action = 'store_true',
        help="If set, persistent settings will be reset for the all profiles.")

    parser.add_argument('--reset-registry', dest='reset_registry', action = 'store_true',
        help="If set, the registry will be reset to contain only the default plugins.")

    parser.add_argument('--version', action = 'store_true',
        help="Prints the program version.")

    parser.add_argument('-l', '--log-level', dest='log_level', default='warning',
        help="Log level. Only log messages with a level higher or equal than this will be printed. "
             "Default: 'warning'",
        choices=('debug', 'info', 'warning', 'error', 'critical'))

    args = parser.parse_args(remove_process_serial_number(sys.argv[1:]))

    if DEBUGGING:
        logger.info("Setting log level to: {}".format(args.log_level.upper()))
    logger.setLevel(args.log_level.upper())

    if DEBUGGING:
        logger.warn("Debugging flag is on!")

    if args.version:
        print(about_str)
        sys.exit(0)

    if args.list_inspectors:
        printInspectors()
        sys.exit(0)

    logger.info('Started {} {}'.format(PROJECT_NAME, VERSION))
    logger.info("Python version: {}".format(sys.version).replace('\n', ''))
    #logger.info('Using: {}'.format('PyQt' if USE_PYQT else 'PySide'))

    # Imported here so this module can be imported without Qt being installed.
    from argos.qt.misc import ABOUT_QT_BINDINGS
    logger.info("Using {}".format(ABOUT_QT_BINDINGS))

    # Browse will create an ArgosApplication with one MainWindow
    browse(fileNames = args.fileNames,
           inspectorFullName=args.inspector,
           select=args.selectPath,
           profile=args.profile,
           resetProfile=args.reset_profile,
           resetAllProfiles=args.reset_all_profiles,
           resetRegistry=args.reset_registry)
    logger.info('Done {}'.format(PROJECT_NAME))
187399
def command_line(self, input_path=None):
        '''
        '''
        
        if self.min_orf_length:
            orfm_arg_l = " -m %d" % self.min_orf_length
        else:
            orfm_arg_l = ''
        
        if self.restrict_read_length:
            orfm_arg_l = " -l %d" % self.restrict_read_length
            
        cmd = 'orfm %s ' % orfm_arg_l
        if input_path:
            cmd += input_path
        logging.debug("OrfM command chunk: %s" % cmd)
        return cmd
301199
def main(args=sys.argv):
    

    parser = create_optparser(args[0])
    return cli(parser.parse_args(args[1:]))
779649
def command_line_runner():
    """"""
    parser = get_parser()
    args = vars(parser.parse_args())
    if args['version']:
        print(__version__)
        return
    if args['clear_cache']:
        utils.clear_cache()
        print('Cleared {0}.'.format(utils.CACHE_DIR))
        return
    if not args['query']:
        parser.print_help()
        return

    # Enable cache unless user sets environ variable SCRAPE_DISABLE_CACHE
    if not os.getenv('SCRAPE_DISABLE_CACHE'):
        utils.enable_cache()

    # Save images unless user sets environ variable SCRAPE_DISABLE_IMGS
    if os.getenv('SCRAPE_DISABLE_IMGS'):
        args['no_images'] = True

    # Prompt user for filetype if none specified
    prompt_filetype(args)

    # Prompt user to save images when crawling (for pdf and HTML formats)
    prompt_save_images(args)

    # Scrape webpage content
    scrape(args)
50457
public static void main(String[] arg) {

        bMustExit = true;

        // (ulrivo): read all arguments from the command line
        int i = 0;

        while (i < arg.length) {
            if (arg[i].equalsIgnoreCase("-driver") && (i + 1 < arg.length)) {
                i++;

                defDriver = arg[i];
            } else if (arg[i].equalsIgnoreCase("-url")
                       && (i + 1 < arg.length)) {
                i++;

                defURL = arg[i];
            } else if (arg[i].equalsIgnoreCase("-width")
                       && (i + 1 < arg.length)) {
                i++;

                try {
                    defWidth = Integer.parseInt(arg[i]);
                } catch (Exception e) {}
            } else if (arg[i].equalsIgnoreCase("-height")
                       && (i + 1 < arg.length)) {
                i++;

                try {
                    defHeight = Integer.parseInt(arg[i]);
                } catch (Exception e) {}
            } else if (arg[i].equalsIgnoreCase("-locx")
                       && (i + 1 < arg.length)) {
                i++;

                try {
                    defLocX = Integer.parseInt(arg[i]);
                } catch (Exception e) {}
            } else if (arg[i].equalsIgnoreCase("-locy")
                       && (i + 1 < arg.length)) {
                i++;

                try {
                    defLocY = Integer.parseInt(arg[i]);
                } catch (Exception e) {}
            } else if (arg[i].equalsIgnoreCase("-user")
                       && (i + 1 < arg.length)) {
                i++;

                defUser = arg[i];
            } else if (arg[i].equalsIgnoreCase("-password")
                       && (i + 1 < arg.length)) {
                i++;

                defPassword = arg[i];
            } else if (arg[i].equalsIgnoreCase("-query")
                       && (i + 1 < arg.length)) {
                i++;

                defQuery = arg[i];
            } else if (arg[i].equalsIgnoreCase("-defDirectory")
                       && (i + 1 < arg.length)) {
                i++;

                defDirectory = arg[i];
            } else if (arg[i].equalsIgnoreCase("-database")
                       && (i + 1 < arg.length)) {
                i++;

                defDatabase = arg[i];
            } else {
                showUsage();

                return;
            }

            i++;
        }

        ZaurusDatabaseManager m = new ZaurusDatabaseManager();

        m.main();

        // (ulrivo): make default connection if arguments set via the command line
        Connection c = null;

        if ((defDriver != null && defURL != null) || (defDatabase != null)) {
            if (defDatabase != null) {
                defDriver   = "org.hsqldb_voltpatches.jdbcDriver";
                defURL      = "jdbc:hsqldb:" + defDatabase;
                defUser     = "SA";
                defPassword = "";
            }

            try {
                Class.forName(defDriver).newInstance();

                c = DriverManager.getConnection(defURL, defUser, defPassword);
            } catch (Exception e) {
                System.out.println("No connection for " + defDriver + " at "
                                   + defURL);
                e.printStackTrace();
            }
        } else {
            c = ZaurusConnectionDialog.createConnection(m.fMain, "Connect",
                    new Insets(defWidth, defHeight, defLocX, defLocY));
        }

        if (c == null) {
            return;
        }

        m.connect(c);
    }
1138895
def main(ctx, opts, version):
    """"""
    # pylint: disable=unused-argument
    if version:
        print_version()
    elif ctx.invoked_subcommand is None:
        click.echo(ctx.get_help())
847637
function cli(args) {
    const { _: [command] } = args;
    return getModule(command).default(args)
        .catch(err => {
            getModule('input').emitError(err.message);
            process.exit(1);
        });
}
1232916
def _call_cmd_line(self):
        """"""
        try:
            logging.info("Calling Popen with: {}".format(self.args))
            p = Popen(self.args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
        except OSError:
            raise(RuntimeError("No such command found in PATH"))

        # Calling this command with newline as stdin as the
        # iCommnads hangs waiting for user input if the password
        # has not been set or has timed out.
        self.stdout, self.stderr = p.communicate("\n".encode())
        self.stdout = self.stdout.decode("utf-8")
        self.stderr = self.stderr.decode("utf-8")
        self.returncode = p.returncode
191117
def main():
    """"""
    # Setup logging for the command line
    name = os.path.splitext(os.path.basename(__file__))[0]
    logging.basicConfig(
        format="%(asctime)s [%(process)s] %(levelname)s {} - %(message)s".format(name),
        level=logging.INFO)

    # Program arguments
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--edges", metavar="FILENAME", required=True,
                        help="input network edges file in TSV format")
    parser.add_argument("--output-clusters", metavar="FILENAME", required=True,
                        help="output clusters file in JSON format")
    parser.add_argument("--oslom-output", metavar="DIRECTORY", required=True,
                        help="output directory for OSLOM files")
    parser.add_argument("--min-cluster-size", metavar="INTEGER", type=int,
                        default=DEF_MIN_CLUSTER_SIZE,
                        help="minimum cluster size (default: %(default)s)")
    parser.add_argument("--oslom-exec", metavar="EXECUTABLE",
                        default=DEF_OSLOM_EXEC,
                        help="OSLOM executable program to use "
                             "(default: %(default)s)")
    parser.add_argument("oslom_args", metavar="OSLOM_ARG", nargs="*",
                        default=DEF_OSLOM_ARGS,
                        help="argument to pass to OSLOM (don't pass '-f' !) "
                             "(default: %(default)s)")

    # Run OSLOM with parsed arguments
    sys.exit(not run(parser.parse_args()))
1093360
def main():
    """"""

    config = Config()

    # additional options for command line client only
    defaults = vars(config)
    defaults['to_format'] = None
    defaults['output'] = '-'
    defaults['log'] = None
    defaults['debug'] = False

    options, remainingArgs = get_option_parser(defaults).parse_args()
    for key in vars(options):
        if hasattr(config, key):
            setattr(config, key, getattr(options, key))

    # configure logging, messages to stderr by default
    logformat = '%(levelname)s: %(message)s'
    loglevel = logging.INFO
    if options.debug:
        loglevel = logging.DEBUG
    if options.log:
        logging.basicConfig(filename=options.log,
                            format=logformat, level=loglevel)
    else:
        logging.basicConfig(format=logformat, level=loglevel)

    output = options.output
    to_format = options.to_format

    # read config file as defaults and override from command line arguments
    if options.config is not None:
        config.read_and_parse_config_file(options.config)
        options, remainingArgs = get_option_parser(vars(config)).parse_args()
        for key in vars(options):
            if hasattr(config, key):
                setattr(config, key, getattr(options, key))

    if remainingArgs:
        inputfiles = remainingArgs
    else:
        inputfiles = ['-']

    voc = skosify(*inputfiles, **vars(config))
    write_rdf(voc, output, to_format)
746212
def text_ui(self):
        
        self.logger.info("Starting command line interface")
        self.help()
        try:
            self.ipython_ui()
        except ImportError:
            self.fallback_ui()
        self.system.cleanup()
1315205
def main(argv=None):
    
    if not argv:
        argv = sys.argv[1:]

    parser = argparse.ArgumentParser(description=_HELP_TEXT)
    parser.add_argument('input', nargs='?', default=None)
    parser.add_argument('output', nargs='?', default=None)
    parser.add_argument('--version', action='version',
                        version='%(prog)s ' + get_version())
    args = parser.parse_args(argv)

    if not args.input:
        print("No file specified", file=sys.stderr)
        sys.exit(1)

    try:
        with open(args.input, 'r') as f:
            res = mangle(f.read())
            if not args.output:
                print(res, end='')
            else:
                with open(args.output, 'w') as o:
                    o.write(res)
    except Exception as ex:
        print("Error mangling {}: {!s}".format(args.input, ex),
              file=sys.stderr)
        sys.exit(1)
1134707
def main():
    
    global args, server_address

    # parse the command line arguments
    parser = ArgumentParser(description=__doc__)
    parser.add_argument(
        "host", nargs='?',
        help="address of host (default %r)" % (SERVER_HOST,),
        default=SERVER_HOST,
        )
    parser.add_argument(
        "port", nargs='?', type=int,
        help="server port (default %r)" % (SERVER_PORT,),
        default=SERVER_PORT,
        )
    parser.add_argument(
        "--hello", action="store_true",
        default=False,
        help="send a hello message",
        )
    parser.add_argument(
        "--connect-timeout", nargs='?', type=int,
        help="idle connection timeout",
        default=CONNECT_TIMEOUT,
        )
    parser.add_argument(
        "--idle-timeout", nargs='?', type=int,
        help="idle connection timeout",
        default=IDLE_TIMEOUT,
        )
    args = parser.parse_args()

    if _debug: _log.debug("initialization")
    if _debug: _log.debug("    - args: %r", args)

    # extract the server address and port
    host = args.host
    port = args.port
    server_address = (host, port)
    if _debug: _log.debug("    - server_address: %r", server_address)

    # build the stack
    this_console = ConsoleClient()
    if _debug: _log.debug("    - this_console: %r", this_console)

    this_middle_man = MiddleMan()
    if _debug: _log.debug("    - this_middle_man: %r", this_middle_man)

    this_director = TCPClientDirector(
        connect_timeout=args.connect_timeout,
        idle_timeout=args.idle_timeout,
        )
    if _debug: _log.debug("    - this_director: %r", this_director)

    bind(this_console, this_middle_man, this_director)
    bind(MiddleManASE(), this_director)

    # create a task manager for scheduled functions
    task_manager = TaskManager()
    if _debug: _log.debug("    - task_manager: %r", task_manager)

    # don't wait to connect
    deferred(this_director.connect, server_address)

    # send hello maybe
    if args.hello:
        deferred(this_middle_man.indication, PDU(b'Hello, world!\n'))

    if _debug: _log.debug("running")

    run()

    if _debug: _log.debug("fini")
361262
def main():
    
    command = Command.lookup(args.get(0))

    if len(args) == 0 or args.contains(('-h', '--help', 'help')):
        display_info(args)
        sys.exit(1)

    elif args.contains(('-v', '--version')):
        display_version()
        sys.exit(1)

    elif command:
        arg = args.get(0)
        args.remove(arg)
        command.__call__(command, args)
        sys.exit()

    else:
        show_error(colored.red('Error! Unknown command \'{0}\'.\n'
                               .format(args.get(0))))
        display_info(args)
        sys.exit(1)