org.apache.commons.cli.HelpFormatter Java Examples

The following examples show how to use org.apache.commons.cli.HelpFormatter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Main.java    From parquet-tools with Apache License 2.0 6 votes vote down vote up
public static void showUsage(HelpFormatter format, PrintWriter err, String name, Command command) {
  Options options = mergeOptions(OPTIONS, command.getOptions());
  String[] usage = command.getUsageDescription();

  String ustr = name + " [option...]";
  if (usage != null && usage.length >= 1) {
    ustr = ustr + " " + usage[0];
  }
    
  format.printUsage(err, WIDTH, ustr);
  format.printWrapped(err, WIDTH, LEFT_PAD, "where option is one of:");
  format.printOptions(err, WIDTH, options, LEFT_PAD, DESC_PAD);

  if (usage != null && usage.length >= 2) {
    for (int i = 1; i < usage.length; ++i) {
      format.printWrapped(err, WIDTH, LEFT_PAD, usage[i]);
    }
  }
}
 
Example #2
Source File: TermsDataCommand.java    From incubator-retired-blur with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("static-access")
private static CommandLine parse(String[] otherArgs, Writer out) {
  Options options = new Options();
  options.addOption(OptionBuilder.withArgName("startwith").hasArg().withDescription("The value to start with.")
      .create("s"));
  options.addOption(OptionBuilder.withArgName("size").hasArg().withDescription("The number of terms to return.")
      .create("n"));
  options.addOption(OptionBuilder.withDescription("Get the frequency of each term.").create("F"));

  CommandLineParser parser = new PosixParser();
  CommandLine cmd = null;
  try {
    cmd = parser.parse(options, otherArgs);
  } catch (ParseException e) {
    HelpFormatter formatter = new HelpFormatter();
    PrintWriter pw = new PrintWriter(out, true);
    formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, "terms", null, options, HelpFormatter.DEFAULT_LEFT_PAD,
        HelpFormatter.DEFAULT_DESC_PAD, null, false);
    return null;
  }
  return cmd;
}
 
Example #3
Source File: CreateShallowSeqDB.java    From hmftools with GNU General Public License v3.0 6 votes vote down vote up
public static void main(@NotNull String[] args) throws ParseException, IOException {
    Options options = createBasicOptions();
    CommandLine cmd = createCommandLine(args, options);

    if (!checkInputs(cmd)) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("shallow seq db ", options);
        System.exit(1);
    }

    LOGGER.info("Loading shallow seq runs from {}", cmd.getOptionValue(RUNS_DIRECTORY));
    List<RunContext> runContexts = loadRunContexts(cmd.getOptionValue(RUNS_DIRECTORY));

    List<LimsShallowSeqData> newShallowSeqEntries = extractNewEntriesForShallowDbFromRunContexts(runContexts,
            cmd.getOptionValue(SHALLOW_SEQ_TSV),
            cmd.getOptionValue(RUNS_DIRECTORY),
            cmd.getOptionValue(PURPLE_QC_FILE),
            cmd.getOptionValue(PURPLE_PURITY_P4_TSV),
            cmd.getOptionValue(PURPLE_PURITY_P5_TSV),
            cmd.getOptionValue(PIPELINE_VERSION));

    appendToCsv(cmd.getOptionValue(SHALLOW_SEQ_TSV), newShallowSeqEntries);

    LOGGER.info("Shallow seq DB is complete!");
}
 
Example #4
Source File: NomadJobMasterStarter.java    From twister2 with Apache License 2.0 6 votes vote down vote up
public NomadJobMasterStarter(String[] args) {
  Options cmdOptions = null;
  try {
    cmdOptions = setupOptions();
    CommandLineParser parser = new DefaultParser();
    // parse the help options first.
    CommandLine cmd = parser.parse(cmdOptions, args);

    // lets determine the process id
    int rank = 0;

    // load the configuration
    // we are loading the configuration for all the components
    this.config = loadConfigurations(cmd, rank);
    controller = new NomadController(true);
    controller.initialize(config);
  } catch (ParseException e) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp("SubmitterMain", cmdOptions);
    throw new RuntimeException("Error parsing command line options: ", e);
  }
}
 
Example #5
Source File: WinnowAnalyzedElevate.java    From quaerite with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    CommandLine commandLine = null;

    try {
        commandLine = new DefaultParser().parse(OPTIONS, args);
    } catch (ParseException e) {
        HelpFormatter helpFormatter = new HelpFormatter();
        helpFormatter.printHelp(
                "java -jar org.mitre.quaerite.solrtools.WinnowAnalyzedElevate",
                OPTIONS);
        return;
    }
    Path inputElevate = Paths.get(commandLine.getOptionValue("e"));
    Path winnowElevate = Paths.get(commandLine.getOptionValue("w"));

    SearchClient client = SearchClientFactory.getClient(commandLine.getOptionValue("s"));
    String analysisField = commandLine.getOptionValue("f");
    DocSorter docSorter = new DocSorter(commandLine.getOptionValue("i"));
    boolean commentWinnowed = (commandLine.hasOption("c") ? true : false);
    WinnowAnalyzedElevate winnowAnalyzedElevate = new WinnowAnalyzedElevate(docSorter, commentWinnowed);
    winnowAnalyzedElevate.execute(inputElevate, winnowElevate, client, analysisField);
}
 
Example #6
Source File: PingServer.java    From tchannel-java with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Options options = new Options();
    options.addOption("p", "port", true, "Server Port to connect to");
    options.addOption("?", "help", false, "Usage");
    HelpFormatter formatter = new HelpFormatter();

    CommandLineParser parser = new DefaultParser();
    CommandLine cmd = parser.parse(options, args);

    if (cmd.hasOption("?")) {
        formatter.printHelp("PingClient", options, true);
        return;
    }

    int port = Integer.parseInt(cmd.getOptionValue("p", "8888"));

    System.out.println(String.format("Starting server on port: %d", port));
    new PingServer(port).run();
    System.out.println("Stopping server...");
}
 
Example #7
Source File: NomadWorkerStarter.java    From twister2 with Apache License 2.0 6 votes vote down vote up
private NomadWorkerStarter(String[] args) {
  Options cmdOptions = null;
  try {
    cmdOptions = setupOptions();
    CommandLineParser parser = new DefaultParser();
    // parse the help options first.
    CommandLine cmd = parser.parse(cmdOptions, args);

    // lets determine the process id
    int rank = 0;

    // load the configuration
    // we are loading the configuration for all the components
    this.config = loadConfigurations(cmd, rank);
    controller = new NomadController(true);
    controller.initialize(config);
  } catch (ParseException e) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp("SubmitterMain", cmdOptions);
    throw new RuntimeException("Error parsing command line options: ", e);
  }
}
 
Example #8
Source File: AbstractTestTopology.java    From incubator-heron with Apache License 2.0 6 votes vote down vote up
protected AbstractTestTopology(String[] args) throws MalformedURLException {
  CommandLineParser parser = new DefaultParser();
  HelpFormatter formatter = new HelpFormatter();
  Options options = getArgOptions();

  try {
    cmd = parser.parse(options, args);
  } catch (ParseException e) {
    formatter.setWidth(120);
    formatter.printHelp("java " + getClass().getCanonicalName(), options, true);
    throw new RuntimeException(e);
  }

  this.topologyName = cmd.getOptionValue(TOPOLOGY_OPTION);
  if (cmd.getOptionValue(RESULTS_URL_OPTION) != null) {
    this.httpServerResultsUrl =
        pathAppend(cmd.getOptionValue(RESULTS_URL_OPTION), this.topologyName);
  } else {
    this.httpServerResultsUrl = null;
  }
}
 
Example #9
Source File: FlinkYarnSessionCli.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private void printUsage() {
	System.out.println("Usage:");
	HelpFormatter formatter = new HelpFormatter();
	formatter.setWidth(200);
	formatter.setLeftPadding(5);
	formatter.setSyntaxPrefix("   Required");
	Options req = new Options();
	req.addOption(container);
	formatter.printHelp(" ", req);

	formatter.setSyntaxPrefix("   Optional");
	Options options = new Options();
	addGeneralOptions(options);
	addRunOptions(options);
	formatter.printHelp(" ", options);
}
 
Example #10
Source File: ActiveOptionProcessor.java    From ofexport2 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void printHelp() throws IOException {

    System.out.println (progName.toUpperCase());
    System.out.println();

    try (
        InputStream in = this.getClass().getResourceAsStream("/version.properties")) {
        Properties p = new Properties();
        p.load(in);
        System.out.println ("Version: " + p.getProperty("version"));
        System.out.println ("Build Date: " + p.getProperty("date"));

    }

    System.out.println();

    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(200);
    // Output in the order I specify
    formatter.setOptionComparator((x, y) -> ((ActiveOption<P>) x).getOrder() - ((ActiveOption<P>) y).getOrder());
    formatter.printHelp(progName, options);
}
 
Example #11
Source File: ServerUtil.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public static CommandLine parseCmdLine(final String appName, String[] args, Options options,
    CommandLineParser parser) {
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(110);
    CommandLine commandLine = null;
    try {
        commandLine = parser.parse(options, args);
        if (commandLine.hasOption('h')) {
            hf.printHelp(appName, options, true);
            return null;
        }
    } catch (ParseException e) {
        hf.printHelp(appName, options, true);
    }

    return commandLine;
}
 
Example #12
Source File: HealthChecksApplication.java    From hmftools with GNU General Public License v3.0 6 votes vote down vote up
public static void main(final String... args) throws ParseException, IOException {
    Options options = createOptions();
    CommandLine cmd = createCommandLine(options, args);

    String refSample = cmd.getOptionValue(REF_SAMPLE);
    String metricsDir = cmd.getOptionValue(METRICS_DIR);
    String outputDir = cmd.getOptionValue(OUTPUT_DIR);

    if (refSample == null || metricsDir == null || outputDir == null) {
        final HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("Health-Checks", options);
        System.exit(1);
    }

    String tumorSample = cmd.hasOption(TUMOR_SAMPLE) ? cmd.getOptionValue(TUMOR_SAMPLE) : null;
    String amberDir = cmd.hasOption(AMBER_DIR) ? cmd.getOptionValue(AMBER_DIR) : null;
    String purpleDir = cmd.hasOption(PURPLE_DIR) ? cmd.getOptionValue(PURPLE_DIR) : null;

    new HealthChecksApplication(refSample, tumorSample, metricsDir, amberDir, purpleDir, outputDir).run(true);
}
 
Example #13
Source File: PonApplication.java    From hmftools with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws IOException, ParseException, ExecutionException, InterruptedException {
    final Options options = createOptions();
    final CommandLine cmd = createCommandLine(args, options);
    final String inputFilePath = cmd.getOptionValue(IN_VCF);
    final String outputFilePath = cmd.getOptionValue(OUT_VCF);
    final int threads = Configs.defaultIntValue(cmd, THREADS, 5);

    if (outputFilePath == null || inputFilePath == null) {
        final HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("PonApplication", options);
        System.exit(1);
    }

    try (PonApplication app = new PonApplication(threads, inputFilePath, outputFilePath)) {
        app.run();
    }
}
 
Example #14
Source File: VdsVisitTarget.java    From vespa with Apache License 2.0 5 votes vote down vote up
private void printSyntax(Options options) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp("vespa-visit-target <options>", "Retrieve results from a visitor", options ,
                        "One, and only one, of the binding options must be present.\n" +
                        "\n" +
                        "For more detailed information, such as defaults and format of\n" +
                        "arguments, refer to 'man vespa-visit-target'.\n");
}
 
Example #15
Source File: UDAFEvaluatorWithOptions.java    From incubator-hivemall with Apache License 2.0 5 votes vote down vote up
@Nonnull
protected final CommandLine parseOptions(@Nonnull String optionValue)
        throws UDFArgumentException {
    String[] args = optionValue.split("\\s+");
    Options opts = getOptions();
    opts.addOption("help", false, "Show function help");

    final CommandLine cl;
    try {
        cl = CommandLineUtils.parseOptions(args, opts);
    } catch (IllegalArgumentException e) {
        throw new UDFArgumentException(e);
    }

    if (cl.hasOption("help")) {
        Description funcDesc = getClass().getAnnotation(Description.class);
        final String cmdLineSyntax;
        if (funcDesc == null) {
            cmdLineSyntax = getClass().getSimpleName();
        } else {
            String funcName = funcDesc.name();
            cmdLineSyntax = funcName == null ? getClass().getSimpleName()
                    : funcDesc.value().replace("_FUNC_", funcDesc.name());
        }
        StringWriter sw = new StringWriter();
        sw.write('\n');
        PrintWriter pw = new PrintWriter(sw);
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, cmdLineSyntax, null, opts,
            HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null, true);
        pw.flush();
        String helpMsg = sw.toString();
        throw new UDFArgumentException(helpMsg);
    }

    return cl;
}
 
Example #16
Source File: LogsCLI.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void printHelpMessage(Options options) {
  System.out.println("Retrieve logs for completed YARN applications.");
  HelpFormatter formatter = new HelpFormatter();
  formatter.printHelp("yarn logs -applicationId <application ID> [OPTIONS]", new Options());
  formatter.setSyntaxPrefix("");
  formatter.printHelp("general options are:", options);
}
 
Example #17
Source File: MetaProcessor.java    From aliyun-maxcompute-data-collectors with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  Option meta = Option
      .builder("i")
      .longOpt("input-dir")
      .argName("input-dir")
      .hasArg()
      .desc("Directory generated by meta carrier")
      .build();
  Option outputDir = Option
      .builder("o")
      .longOpt("output-dir")
      .argName("output-dir")
      .hasArg()
      .desc("Output directory generated by meta processor")
      .build();
  Option help = Option
      .builder("h")
      .longOpt("help")
      .argName("help")
      .desc("Print help information")
      .build();

  Options options = new Options();
  options.addOption(meta);
  options.addOption(outputDir);
  options.addOption(help);

  CommandLineParser parser = new DefaultParser();
  CommandLine cmd = parser.parse(options, args);

  if (cmd.hasOption("input-dir") && cmd.hasOption("output-dir") && !cmd.hasOption("help")) {
    MetaProcessor metaProcessor = new MetaProcessor(cmd.getOptionValue("input-dir"));
    metaProcessor.run(cmd.getOptionValue("output-dir"));
  } else {
      HelpFormatter formatter = new HelpFormatter();
      String cmdLineSyntax =
          "meta-processor -i <metadata directory> -o <output directory>";
      formatter.printHelp(cmdLineSyntax, options);
  }
}
 
Example #18
Source File: CommandLineHelper.java    From antsdb with GNU Lesser General Public License v3.0 5 votes vote down vote up
public CommandLine parse(Options options, String[] args) throws ParseException {
    CommandLineParser parser = new DefaultParser();
    options.addOption("h", "help", false, "help");
    CommandLine line = parser.parse(options, args);
    if (line.hasOption('h')) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(getCommandName(), options);
        System.exit(0);
    }
    return line;
}
 
Example #19
Source File: PythonShellParser.java    From flink with Apache License 2.0 5 votes vote down vote up
private static void printYarnHelp() {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);
	System.out.println("Command: yarn [options]");
	System.out.println("Starts Flink Python shell connecting to a yarn cluster");
	formatter.printHelp(" ", YARN_OPTIONS);
}
 
Example #20
Source File: Cli.java    From incubator-iotdb with Apache License 2.0 5 votes vote down vote up
/**
 * IoTDB Client main function.
 *
 * @param args launch arguments
 * @throws ClassNotFoundException ClassNotFoundException
 */
public static void main(String[] args) throws ClassNotFoundException {
  Class.forName(Config.JDBC_DRIVER_NAME);
  Options options = createOptions();
  HelpFormatter hf = new HelpFormatter();
  hf.setWidth(MAX_HELP_CONSOLE_WIDTH);
  commandLine = null;

  String[] newArgs;
  String[] newArgs2;

  if (args == null || args.length == 0) {
    println(
        "Require more params input, eg. ./start-cli.sh(start-cli.bat if Windows) "
            + "-h xxx.xxx.xxx.xxx -p xxxx -u xxx.");
    println("For more information, please check the following hint.");
    hf.printHelp(SCRIPT_HINT, options, true);
    return;
  }
  init();
  newArgs = removePasswordArgs(args);
  newArgs2 = processExecuteArgs(newArgs);
  boolean continues = parseCommandLine(options, newArgs2, hf);
  if (!continues) {
    return;
  }

  serve();
}
 
Example #21
Source File: SageApplication.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
public static void main(final String... args) throws IOException, InterruptedException, ExecutionException {
    final Options options = SageConfig.createOptions();
    try (final SageApplication application = new SageApplication(options, args)) {
        application.run();
    } catch (ParseException e) {
        LOGGER.warn(e);
        final HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("SageApplication", options);
        System.exit(1);
    }
}
 
Example #22
Source File: CommandCli.java    From iotdb-benchmark with Apache License 2.0 5 votes vote down vote up
public boolean init(String[] args){
	Options options = createOptions();
	HelpFormatter hf = new HelpFormatter();
	hf.setWidth(MAX_HELP_CONSOLE_WIDTH);
	CommandLine commandLine = null;
	CommandLineParser parser = new DefaultParser();

	if (args == null || args.length == 0) {
		System.out.println("Require more params input, please check the following hint.");
		hf.printHelp(Constants.CONSOLE_PREFIX, options, true);
		return false;
	}
	return parseParams(commandLine, parser, options, args, hf);
}
 
Example #23
Source File: CommandLineOptions.java    From vespa with Apache License 2.0 5 votes vote down vote up
public void printHelp() {
    HelpFormatter formatter = new HelpFormatter();

    formatter.printHelp(
            "vespa-get <options> [documentid...]", "Fetch a document from a Vespa Content cluster.", options,
            "If one or more document identifier are specified, these documents will be " +
                    "retrieved. Otherwise, document identifiers (separated with line break) will be read from standard in.\n",
            false);
}
 
Example #24
Source File: QualityMeasuresCLI.java    From codebase with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void showHelp(Options options) {
	HelpFormatter formatter = new HelpFormatter();
	
	showHeader();
   	formatter.printHelp(120, String.format("java -jar jbpt-pm.jar <options>", QualityMeasuresCLI.version), 
   							String.format("", QualityMeasuresCLI.version), options, 
   							"================================================================================\n");
}
 
Example #25
Source File: CommandLineFacade.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
public void printHelp(String application) {
    PrintWriter writer = new PrintWriter(System.out);
    HelpFormatter formatter = new HelpFormatter();

    writer.println(String.format("Usage: %s [params]", application));
    writer.println();
    writer.println("Options");
    formatter.printOptions(writer, 128, options, 4, 4);
    writer.println();
    writer.flush();
}
 
Example #26
Source File: CountBamLinesApplication.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
public static void main(final String... args) throws IOException, ExecutionException, InterruptedException {
    final Options options = CobaltConfig.createOptions();
    try (final CountBamLinesApplication application = new CountBamLinesApplication(options, args)) {
        application.run();
    } catch (ParseException e) {
        LOGGER.warn(e);
        final HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("CountBamLinesApplication", options);
        System.exit(1);
    }
}
 
Example #27
Source File: GateGenerationRunner.java    From iBioSim with Apache License 2.0 5 votes vote down vote up
private static void printUsage() {
	HelpFormatter formatter = new HelpFormatter();
	String sbolUsage = "-f <arg(s)> -od usr/dir -";
	formatter.printHelp(125, sbolUsage, 
			"Gate Generation Options", 
			getCommandLineOptions(), 
			"Note: <arg> is the user's input value.");
}
 
Example #28
Source File: AbstractHalyardTool.java    From Halyard with Apache License 2.0 5 votes vote down vote up
protected final void printHelp() {
    HelpFormatter hf = new HelpFormatter();
    hf.setOptionComparator(new Comparator() {
        @Override
        public int compare(Object o1, Object o2) {
            if (o1 instanceof OrderedOption && o2 instanceof OrderedOption) return ((OrderedOption)o1).order - ((OrderedOption)o2).order;
            else return 0;
        }
    });
    hf.printHelp(100, "halyard " + name, header, options, footer, true);
}
 
Example #29
Source File: StellarShell.java    From metron with Apache License 2.0 5 votes vote down vote up
/**
 * Create a Stellar REPL.
 * @param args The commmand-line arguments.
 */
public StellarShell(String[] args) throws Exception {

  // define valid command-line options
  CommandLineParser parser = new PosixParser();
  Options options = defineCommandLineOptions();
  CommandLine commandLine = parser.parse(options, args);

  // print help
  if(commandLine.hasOption("h")) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp("stellar", options);
    System.exit(0);
  }

  // validate the command line options
  try {
    StellarShellOptionsValidator.validateOptions(commandLine);

  } catch(IllegalArgumentException e){
    System.err.println(e.getMessage());
    System.exit(1);
  }

  // setup logging, if specified
  if(commandLine.hasOption("l")) {
    PropertyConfigurator.configure(commandLine.getOptionValue("l"));
  }

  console = createConsole(commandLine);
  autoCompleter = new DefaultStellarAutoCompleter();
  Properties props = getStellarProperties(commandLine);
  executor = createExecutor(commandLine, console, props, autoCompleter);
  loadVariables(commandLine, executor);
  console.setPrompt(new Prompt(EXPRESSION_PROMPT));
  console.addCompletion(this);
  console.setConsoleCallback(this);
}
 
Example #30
Source File: SecureWriter.java    From pravega-samples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    Options options = getOptions();

    CommandLine cmd = null;
    try {
        cmd = parseCommandLineArgs(options, args);
    } catch (ParseException e) {
        System.out.format("%s.%n", e.getMessage());
        final HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("HelloWorldReader", options);
        System.exit(1);
    }

    final String scope = cmd.getOptionValue("scope") == null ? Constants.DEFAULT_SCOPE : cmd.getOptionValue("scope");
    final String stream = cmd.getOptionValue("stream") == null ? Constants.DEFAULT_STREAM_NAME : cmd.getOptionValue("stream");

    final String uriString = cmd.getOptionValue("uri") == null ? Constants.DEFAULT_CONTROLLER_URI : cmd.getOptionValue("uri");
    final URI controllerURI = URI.create(uriString);

    final String truststorePath =
            cmd.getOptionValue("truststore") == null ? Constants.DEFAULT_TRUSTSTORE_PATH : cmd.getOptionValue("truststore");
    final boolean validateHostname = cmd.getOptionValue("validatehost") == null ? false : true;

    final String username = cmd.getOptionValue("username") == null ? Constants.DEFAULT_USERNAME : cmd.getOptionValue("username");
    final String password = cmd.getOptionValue("password") == null ? Constants.DEFAULT_PASSWORD : cmd.getOptionValue("password");

    final String routingKey = cmd.getOptionValue("routingKey") == null ? Constants.DEFAULT_ROUTING_KEY : cmd.getOptionValue("routingKey");
    final String message = cmd.getOptionValue("message") == null ? Constants.DEFAULT_MESSAGE : cmd.getOptionValue("message");

    SecureWriter writer = new SecureWriter(scope, stream, controllerURI,
            truststorePath, validateHostname,
            username, password);
    writer.write(routingKey, message);
}