Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
Expand Down Expand Up @@ -309,7 +310,9 @@ public Client(String appMasterJar) {
* Helper function to print out usage
*/
private void printUsage() {
new HelpFormatter().printHelp("Client", opts);
HelpFormatter formatter = new HelpFormatter();
formatter.setWidth(100); // Option names are long so increasing the width is helpful
formatter.printHelp("Client", opts);
}

/**
Expand All @@ -320,17 +323,14 @@ private void printUsage() {
*/
public boolean init(String[] args) throws ParseException, IOException {

CommandLine cliParser = new GnuParser().parse(opts, args);

if (args.length == 0) {
throw new IllegalArgumentException("No args specified for client to initialize");
}

if (cliParser.hasOption("help")) {
CommandLineParser parser = new GnuParser();
if (parser.parse(new Options().addOption("h", "help", false, "Shows this message."), args, true).hasOption("h")) {
printUsage();
return false;
}

CommandLine cliParser = parser.parse(opts, args);

yarnClient = YarnClient.createYarnClient();
yarnClient.init(getConf());

Expand Down