Java Code Examples for org.apache.commons.cli.HelpFormatter#setLeftPadding()

The following examples show how to use org.apache.commons.cli.HelpFormatter#setLeftPadding() . 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: FlinkYarnSessionCli.java    From flink 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 2
Source File: LoadModel.java    From djl with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException, ModelException, TranslateException {
    Options options = Arguments.getOptions();
    try {
        DefaultParser parser = new DefaultParser();
        CommandLine cmd = parser.parse(options, args, null, false);
        Arguments arguments = new Arguments(cmd);

        Classifications classifications = predict(arguments);
        logger.info("{}", classifications);
    } catch (ParseException e) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setLeftPadding(1);
        formatter.setWidth(120);
        formatter.printHelp(e.getMessage(), options);
    }
}
 
Example 3
Source File: CliFrontend.java    From stratosphere with Apache License 2.0 5 votes vote down vote up
private void printHelpForList() {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);
	
	System.out.println("\nAction \"list\" lists running and finished programs.");
	formatter.setSyntaxPrefix("  \"list\" action arguments:");
	formatter.printHelp(" ", getListOptions(new Options()));
}
 
Example 4
Source File: PythonShellParser.java    From flink with Apache License 2.0 5 votes vote down vote up
private static void printRemoteHelp() {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);
	System.out.println("Command: remote [options] <host> <port>");
	System.out.println("Starts Flink Python shell connecting to a remote cluster");
	System.out.println("  <host>");
	System.out.println("        Remote host name as string");
	System.out.println("  <port>");
	System.out.println("        Remote port as integer");
	System.out.println();
	formatter.printHelp(" ", REMOTE_OPTIONS);
}
 
Example 5
Source File: CliFrontend.java    From stratosphere with Apache License 2.0 5 votes vote down vote up
/**
 * Prints the help for the client.
 * 
 * @param options A map with options for actions. 
 */
private void printHelp() {
	System.out.println("./stratosphere <ACTION> [GENERAL_OPTIONS] [ARGUMENTS]");
	
	HelpFormatter formatter = new HelpFormatter();
	formatter.setWidth(80);
	formatter.setLeftPadding(5);
	formatter.setSyntaxPrefix("  general options:");
	formatter.printHelp(" ", GENRAL_OPTIONS);
	
	printHelpForRun();
	printHelpForInfo();
	printHelpForList();
	printHelpForCancel();
}
 
Example 6
Source File: CliOptionsParser.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void printHelpEmbeddedModeClient() {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);

	System.out.println("\nMode \"embedded\" submits Flink jobs from the local machine.");
	System.out.println("\n  Syntax: embedded [OPTIONS]");
	formatter.setSyntaxPrefix("  \"embedded\" mode options:");
	formatter.printHelp(" ", EMBEDDED_MODE_CLIENT_OPTIONS);

	System.out.println();
}
 
Example 7
Source File: CliFrontend.java    From stratosphere with Apache License 2.0 5 votes vote down vote up
private void printHelpForCancel() {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);
	
	System.out.println("\nAction \"cancel\" cancels a running program.");
	formatter.setSyntaxPrefix("  \"cancel\" action arguments:");
	formatter.printHelp(" ", getCancelOptions(new Options()));
}
 
Example 8
Source File: CliFrontendParser.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void printHelpForStop(Collection<CustomCommandLine<?>> customCommandLines) {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);

	System.out.println("\nAction \"stop\" stops a running program with a savepoint (streaming jobs only).");
	System.out.println("\n  Syntax: stop [OPTIONS] <Job ID>");
	formatter.setSyntaxPrefix("  \"stop\" action options:");
	formatter.printHelp(" ", getStopOptionsWithoutDeprecatedOptions(new Options()));

	printCustomCliOptions(customCommandLines, formatter, false);

	System.out.println();
}
 
Example 9
Source File: CliFrontendParser.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void printHelpForSavepoint(Collection<CustomCommandLine> customCommandLines) {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);

	System.out.println("\nAction \"savepoint\" triggers savepoints for a running job or disposes existing ones.");
	System.out.println("\n  Syntax: savepoint [OPTIONS] <Job ID> [<target directory>]");
	formatter.setSyntaxPrefix("  \"savepoint\" action options:");
	formatter.printHelp(" ", getSavepointOptionsWithoutDeprecatedOptions(new Options()));

	printCustomCliOptions(customCommandLines, formatter, false);

	System.out.println();
}
 
Example 10
Source File: CliFrontendParser.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void printHelpForSavepoint(Collection<CustomCommandLine<?>> customCommandLines) {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);

	System.out.println("\nAction \"savepoint\" triggers savepoints for a running job or disposes existing ones.");
	System.out.println("\n  Syntax: savepoint [OPTIONS] <Job ID> [<target directory>]");
	formatter.setSyntaxPrefix("  \"savepoint\" action options:");
	formatter.printHelp(" ", getSavepointOptionsWithoutDeprecatedOptions(new Options()));

	printCustomCliOptions(customCommandLines, formatter, false);

	System.out.println();
}
 
Example 11
Source File: CliFrontendParser.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void printHelpForCancel(Collection<CustomCommandLine<?>> customCommandLines) {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);

	System.out.println("\nAction \"cancel\" cancels a running program.");
	System.out.println("\n  Syntax: cancel [OPTIONS] <Job ID>");
	formatter.setSyntaxPrefix("  \"cancel\" action options:");
	formatter.printHelp(" ", getCancelOptionsWithoutDeprecatedOptions(new Options()));

	printCustomCliOptions(customCommandLines, formatter, false);

	System.out.println();
}
 
Example 12
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 13
Source File: CliFrontendParser.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void printHelpForList(Collection<CustomCommandLine<?>> customCommandLines) {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);

	System.out.println("\nAction \"list\" lists running and scheduled programs.");
	System.out.println("\n  Syntax: list [OPTIONS]");
	formatter.setSyntaxPrefix("  \"list\" action options:");
	formatter.printHelp(" ", getListOptionsWithoutDeprecatedOptions(new Options()));

	printCustomCliOptions(customCommandLines, formatter, false);

	System.out.println();
}
 
Example 14
Source File: CliFrontendParser.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void printHelpForList(Collection<CustomCommandLine<?>> customCommandLines) {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);

	System.out.println("\nAction \"list\" lists running and scheduled programs.");
	System.out.println("\n  Syntax: list [OPTIONS]");
	formatter.setSyntaxPrefix("  \"list\" action options:");
	formatter.printHelp(" ", getListOptionsWithoutDeprecatedOptions(new Options()));

	printCustomCliOptions(customCommandLines, formatter, false);

	System.out.println();
}
 
Example 15
Source File: AbstractCustomCommandLine.java    From flink with Apache License 2.0 5 votes vote down vote up
protected void printUsage() {
	System.out.println("Usage:");
	HelpFormatter formatter = new HelpFormatter();
	formatter.setWidth(200);
	formatter.setLeftPadding(5);

	formatter.setSyntaxPrefix("   Optional");
	Options options = new Options();
	addGeneralOptions(options);
	addRunOptions(options);
	formatter.printHelp(" ", options);
}
 
Example 16
Source File: PythonShellParser.java    From flink with Apache License 2.0 5 votes vote down vote up
private static void printLocalHelp() {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);
	System.out.println("Command: local [options]");
	System.out.println("Starts Flink Python shell with a local Flink cluster");
	formatter.printHelp(" ", LOCAL_OPTIONS);
}
 
Example 17
Source File: CliOptionsParser.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void printHelpEmbeddedModeClient() {
	HelpFormatter formatter = new HelpFormatter();
	formatter.setLeftPadding(5);
	formatter.setWidth(80);

	System.out.println("\nMode \"embedded\" submits Flink jobs from the local machine.");
	System.out.println("\n  Syntax: embedded [OPTIONS]");
	formatter.setSyntaxPrefix("  \"embedded\" mode options:");
	formatter.printHelp(" ", EMBEDDED_MODE_CLIENT_OPTIONS);

	System.out.println();
}
 
Example 18
Source File: CLIParser.java    From bcrypt with Apache License 2.0 4 votes vote down vote up
private static void printHelp(Options options) {
    HelpFormatter help = new HelpFormatter();
    help.setWidth(110);
    help.setLeftPadding(4);
    help.printHelp("bcrypt <password>", "Version: " + BcryptTool.jarVersion(), options, "", true);
}
 
Example 19
Source File: CommandLineParser.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public void printHelp(@Nonnull String cmdLineSyntax) {
	final HelpFormatter helpFormatter = new HelpFormatter();
	helpFormatter.setLeftPadding(5);
	helpFormatter.setWidth(80);
	helpFormatter.printHelp(cmdLineSyntax, parserResultFactory.getOptions(), true);
}
 
Example 20
Source File: CommandLineParser.java    From flink with Apache License 2.0 4 votes vote down vote up
public void printHelp(@Nonnull String cmdLineSyntax) {
	final HelpFormatter helpFormatter = new HelpFormatter();
	helpFormatter.setLeftPadding(5);
	helpFormatter.setWidth(80);
	helpFormatter.printHelp(cmdLineSyntax, parserResultFactory.getOptions(), true);
}