private void init() { try { cmdLineOptions.addOption(new Option("help", "Generates a script to execute on 3.x " + "cluster. This requires 3.x binaries on the classpath and hive-site.xml.")); Option exec = new Option("execute", "Executes commands equivalent to generated scrips"); exec.setOptionalArg(true); cmdLineOptions.addOption(exec); cmdLineOptions.addOption(new Option("location", true, "Location to write scripts to. Default is CWD.")); } catch(Exception ex) { LOG.error("init()", ex); throw ex; } } private static IMetaStoreClient getHMS(HiveConf conf) {
private void init() { try { cmdLineOptions.addOption(new Option("help", "Generates a script to execute on 2.x" + " cluster. This requires 2.x binaries on the classpath and hive-site.xml.")); Option exec = new Option("execute", "Executes commands equivalent to generated scrips"); exec.setOptionalArg(true); cmdLineOptions.addOption(exec); cmdLineOptions.addOption(new Option("location", true, "Location to write scripts to. Default is CWD.")); } catch(Exception ex) { LOG.error("init()", ex); throw ex; } } private static HiveMetaHookLoader getHookLoader() {
@Test public void testGetsDefaultIfOptional() throws Exception { String[] args = new String[] { "-k", "-a", "Caesar" }; options.getOption("k").setOptionalArg(true); CommandLine line = parser.parse( options, args); assertEquals( "Caesar", line.getOptionValue("a") ); assertEquals( "a", line.getOptionValue('k', "a") ); }
option.setOptionalArg(optionalArg); option.setArgs(numberOfArgs); option.setType(type);
option = new Option(null, OPT_TRIM_L, true, "Trims leading and trailing spaces from all column values. Column XML names can be optionally specified to set which columns to trim."); option.setOptionalArg(true); commandLineOptions.addOption(option); option = new Option(OPT_JDBC_TO_SFMD, OPT_JDBC_TO_SFMD_L, true,
@Override public Options getOptions() { final Options o = new Options(); secretOption = new Option("s", "secret", true, "specify the instance secret to use"); secretOption.setOptionalArg(false); o.addOption(secretOption); statusOption = new Option("t", "status-type", true, "filter 'print' on the transaction status type(s) {NEW, IN_PROGRESS," + " FAILED_IN_PROGRESS, FAILED, SUCCESSFUL}"); statusOption.setArgs(Option.UNLIMITED_VALUES); statusOption.setOptionalArg(false); o.addOption(statusOption); disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output"); o.addOption(disablePaginationOpt); return o; }
private Options getOptions() { final Options options = new Options(); options.addOption(SCHEMA_NAME_OPTION); options.addOption(DATA_TABLE_OPTION); options.addOption(INDEX_TABLE_OPTION); options.addOption(PARTIAL_REBUILD_OPTION); options.addOption(DIRECT_API_OPTION); options.addOption(RUN_FOREGROUND_OPTION); options.addOption(OUTPUT_PATH_OPTION); options.addOption(SNAPSHOT_OPTION); options.addOption(HELP_OPTION); AUTO_SPLIT_INDEX_OPTION.setOptionalArg(true); options.addOption(AUTO_SPLIT_INDEX_OPTION); SPLIT_INDEX_OPTION.setOptionalArg(true); options.addOption(SPLIT_INDEX_OPTION); return options; }
Option lookAndFeelOption = new Option("f", "look-and-feel", true, "This sets the look and feel."); lookAndFeelOption.setOptionalArg(true); options.addOption(lookAndFeelOption);
private Options getOptions() { final Options options = new Options(); options.addOption(SCHEMA_NAME_OPTION); options.addOption(DATA_TABLE_OPTION); options.addOption(INDEX_TABLE_OPTION); options.addOption(PARTIAL_REBUILD_OPTION); options.addOption(DIRECT_API_OPTION); options.addOption(RUN_FOREGROUND_OPTION); options.addOption(OUTPUT_PATH_OPTION); options.addOption(SNAPSHOT_OPTION); options.addOption(HELP_OPTION); AUTO_SPLIT_INDEX_OPTION.setOptionalArg(true); options.addOption(AUTO_SPLIT_INDEX_OPTION); SPLIT_INDEX_OPTION.setOptionalArg(true); options.addOption(SPLIT_INDEX_OPTION); return options; }
private Options getOptions() { final Options options = new Options(); options.addOption(SCHEMA_NAME_OPTION); options.addOption(DATA_TABLE_OPTION); options.addOption(INDEX_TABLE_OPTION); options.addOption(PARTIAL_REBUILD_OPTION); options.addOption(DIRECT_API_OPTION); options.addOption(RUN_FOREGROUND_OPTION); options.addOption(OUTPUT_PATH_OPTION); options.addOption(SNAPSHOT_OPTION); options.addOption(HELP_OPTION); AUTO_SPLIT_INDEX_OPTION.setOptionalArg(true); options.addOption(AUTO_SPLIT_INDEX_OPTION); SPLIT_INDEX_OPTION.setOptionalArg(true); options.addOption(SPLIT_INDEX_OPTION); return options; }
@Override public Options getOptions() { final Options o = new Options(); secretOption = new Option("s", "secret", true, "specify the instance secret to use"); secretOption.setOptionalArg(false); o.addOption(secretOption); statusOption = new Option("t", "status-type", true, "filter 'print' on the transaction status type(s) {NEW, IN_PROGRESS," + " FAILED_IN_PROGRESS, FAILED, SUCCESSFUL}"); statusOption.setArgs(Option.UNLIMITED_VALUES); statusOption.setOptionalArg(false); o.addOption(statusOption); disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output"); o.addOption(disablePaginationOpt); return o; }
private Options populateValidOptions() { Options validOptions = new Options(); validOptions.addOption("schema", false, "Loads / Stores the schema of the relation using a hidden JSON file."); validOptions.addOption("noschema", false, "Disable attempting to load data schema from the filesystem."); validOptions.addOption(TAG_SOURCE_FILE, false, "Appends input source file name to beginning of each tuple."); validOptions.addOption(TAG_SOURCE_PATH, false, "Appends input source file path to beginning of each tuple."); validOptions.addOption("tagsource", false, "Appends input source file name to beginning of each tuple."); Option overwrite = new Option("overwrite", "Overwrites the destination."); overwrite.setLongOpt("overwrite"); overwrite.setOptionalArg(true); overwrite.setArgs(1); overwrite.setArgName("overwrite"); validOptions.addOption(overwrite); return validOptions; }
/** * Construct Options. * * @return Options expected from command-line. */ private Options constructOptions() { final Options options = new Options(); Option usernameOption = new Option(CliConstants.USERNAME_OPTION, CliConstants.USERNAME_LONG_OPTION, true, "Username"); usernameOption.setArgName("username"); options.addOption(usernameOption); Option passwordOption = new Option(CliConstants.PASSWORD_OPTION, CliConstants.PASSWORD_LONG_OPTION, true, "Password"); passwordOption.setArgName("password"); passwordOption.setOptionalArg(true); options.addOption(passwordOption); options.addOption(CliConstants.HELP_OPTION, CliConstants.HELP_LONG_OPTION, false, "Display this help"); options.addOption(CliConstants.TRACE_OPTION, false, "Enable trace logging"); options.addOption(CliConstants.DEBUG_OPTION, false, "Enable debug logging"); return options; }
private static Options createCommandLine() { Options options = new Options(); options.addOption( HELP_SHORT, HELP_LONG, false, res.helpMessage() ); options.addOption( VERSION_SHORT, VERSION_LONG, false, res.versionHelpMessage() ); Option redeploy = new Option( REDEPLOY_SHORT, REDEPLOY_LONG, true, res.redeployHelpMessage() ); redeploy.setOptionalArg( true ); options.addOption( redeploy ); options.addOption( PERSIST_SHORT, PERSIST_LONG, false, res.persistMasterHelpMessage() ); options.addOption( NOSTART_SHORT, NOSTART_LONG, false, res.nostartHelpMessage() ); return options; }
private static Options createCommandLine() { Options options = new Options(); options.addOption( HELP_SHORT, HELP_LONG, false, res.helpMessage() ); options.addOption( VERSION_SHORT, VERSION_LONG, false, res.versionHelpMessage() ); Option redeploy = new Option( REDEPLOY_SHORT, REDEPLOY_LONG, true, res.redeployHelpMessage() ); redeploy.setOptionalArg( true ); options.addOption( redeploy ); options.addOption( PERSIST_SHORT, PERSIST_LONG, false, res.persistMasterHelpMessage() ); options.addOption( NOSTART_SHORT, NOSTART_LONG, false, res.nostartHelpMessage() ); return options; }
/** * * @return a new option for the parameter. */ Option newOption() { Option option = new Option(shortName, longName, maxArgs != 0, I18N.getResource(resourceKey)); option.setArgs(maxArgs == -1 ? Option.UNLIMITED_VALUES : maxArgs); if (maxArgs != 0) { option.setOptionalArg(!argsRequired); } option.setArgName(argName); return option; }
public Option op() { Option option = new Option( id!=null ? id : " ", description ); option.setLongOpt(name); option.setRequired( required ); option.setOptionalArg(optional); option.setType( type ); option.setValueSeparator(sperator); if( arg !=null && args==-1 ) { args=1; } option.setArgs(args); option.setArgName(arg); return option; }
public Option op() { Option option = new Option( id!=null ? id : " ", description ); option.setLongOpt(name); option.setRequired( required ); option.setOptionalArg(optional); option.setType( type ); option.setValueSeparator(sperator); if( arg !=null && args==-1 ) { args=1; } option.setArgs(args); option.setArgName(arg); return option; }
/** * Creates an Option using OptionBuilder's State and the given parameters. * * @param opt * short representation of the option * @param longOpt * long representation of the option * @param desc * descibes the function of the option * @return the new Option */ public Option create(final String opt, final String longOpt, final String desc) { final Option option = new Option(opt, desc); option.setLongOpt(longOpt); option.setArgs(args); option.setRequired(required); option.setOptionalArg(optionalArg); option.setType(type); option.setValueSeparator(valSeparator); return option; }
public Option op() { Option option = new Option( id!=null ? id : " ", description ); option.setLongOpt(name); option.setRequired( required ); option.setOptionalArg(optional); option.setType( type ); option.setValueSeparator(sperator); if( arg !=null && args==-1 ) { args=1; } option.setArgs(args); option.setArgName(arg); return option; }