org.duracloud.common.cli.GenericHelpCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-cli Show documentation
Show all versions of common-cli Show documentation
Some useful framework classes for building commandline tools
/*
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://duracloud.org/license/
*/
package org.duracloud.common.cli;
import java.util.Map;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.lang.StringUtils;
/**
* @author Daniel Bernstein
*/
public class GenericHelpCommand extends Command {
private Map commandMap;
public GenericHelpCommand(Map commandMap) {
super("help");
this.commandMap = commandMap;
}
@Override
protected Options createOptions() {
return new Options();
}
@Override
protected void executeImpl(String[] args, CommandLine cl) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("(" + StringUtils.join(commandMap.keySet(), "|") + ") [options]", new Options());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy