本文整理汇总了Java中com.beust.jcommander.JCommander.setProgramName方法的典型用法代码示例。如果您正苦于以下问题:Java JCommander.setProgramName方法的具体用法?Java JCommander.setProgramName怎么用?Java JCommander.setProgramName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.beust.jcommander.JCommander
的用法示例。
在下文中一共展示了JCommander.setProgramName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
/**
* Parses command line arguments and populates this command line instance.
* <p>
* If the command line arguments include the "help" argument, or if the
* arguments have incorrect values or order, then usage information is
* printed to {@link System#out} and the program terminates.
*
* @param args
* the command line arguments
* @return an instance of the parsed arguments object
*/
public Arguments parse(String[] args) {
JCommander jCommander = new JCommander(this);
jCommander.setProgramName("jsonschema2pojo");
try {
jCommander.parse(args);
if (this.showHelp) {
jCommander.usage();
exit(EXIT_OKAY);
}
} catch (ParameterException e) {
System.err.println(e.getMessage());
jCommander.usage();
exit(EXIT_ERROR);
}
return this;
}
示例2: VerbSenseArgumentCounter
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
private VerbSenseArgumentCounter(String... args) {
JCommander cmd = new JCommander(this);
cmd.setProgramName(this.getClass().getSimpleName());
try {
if (args.length == 0) {
cmd.usage();
System.exit(0);
}
cmd.parse(args);
} catch (ParameterException e) {
System.err.println(e.getMessage());
cmd.usage();
System.exit(1);
}
initializeDb();
initializeAnnotator();
validateDir();
}
示例3: init
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
@Override
public synchronized void init(DaemonContext context) {
if (state != State.NONE) {
throw new IllegalStateException("initialized already");
}
final JCommander commander = new JCommander(this);
commander.setProgramName(getClass().getName());
commander.parse(context.getArguments());
if (help != null && help) {
commander.usage();
final DaemonController controller = context.getController();
if (controller != null) {
controller.fail();
}
return;
}
state = State.INITIALIZED;
}
示例4: Commander
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
public Commander(Plugin plugin) {
template = new CommandTemplate();
jcommander = new JCommander(template);
jcommander.setProgramName("spellcastr");
bind = new CommandBind();
jcommander.addCommand("bind", bind);
create = new CommandCreate();
jcommander.addCommand("create", create);
setLore = new CommandSetLore();
jcommander.addCommand("lore", setLore);
setItem = new CommandSetItem();
jcommander.addCommand("item", setItem);
craft = new CommandCraft();
jcommander.addCommand("craft", craft);
setType = new CommandSetType();
jcommander.addCommand("type", setType);
setOption = new CommandSetOption();
jcommander.addCommand("option", setOption);
help = new CommandHelp();
jcommander.addCommand("help", help);
this.plugin = plugin;
}
示例5: WordSenseCLI
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
WordSenseCLI(String[] args) {
cmd = new JCommander(this);
cmd.setProgramName(WordSenseCLI.class.getSimpleName());
try {
cmd.parse(args);
if (help || args.length == 0) {
System.out.println(helpMessage);
cmd.usage();
System.exit(0);
}
} catch (ParameterException e) {
System.err.println(e.getMessage());
cmd.usage();
System.exit(1);
}
}
示例6: main
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
public static void main(String[] args) {
Injector injector = Guice.createInjector(new MavenModule(), new MavenCommandOptionsModule(), new XmlModule());
OptionalArgs optionalArgs = injector.getInstance(OptionalArgs.class);
JCommander jCommander = JCommander.newBuilder().addObject(optionalArgs).build();
jCommander.setProgramName("mvnUploader");
jCommander.parse(args);
if (optionalArgs.isHelp()){
jCommander.usage();
} else {
logger.info("Welcome To Maven Artifacts Uploader");
Uploader uploader = injector.getInstance(Uploader.class);
uploader.uploadToRepository(Paths.get(optionalArgs.getPathToArtifacts()));
logger.info("Done uploading all the artifacts!");
}
}
示例7: main
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
public static void main(final String[] args) {
final Options options = new Options();
final JCommander jCommander = JCommander.newBuilder().addObject(options).build();
jCommander.setProgramName(PROGRAM_NAME);
jCommander.parse(args);
if (options.isHelp()) {
jCommander.usage();
} else {
new Main(options).execute();
}
}
示例8: main
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
CommandArgs cmdArgs = new CommandArgs();
JCommander cmdParser = new JCommander(cmdArgs);
try {
cmdParser.setProgramName(GreetingAuthzClient.class.getName());
cmdParser.parse(args);
} catch (ParameterException e) {
StringBuilder info = new StringBuilder("Specifiy the name of the application endpoint with --app\n");
cmdParser.usage(info);
System.err.printf(info.toString());
System.exit(1);
}
// Handle outputCurlScript
if(cmdArgs.outputCurlScript != null) {
InputStream scriptStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("token_req_template.sh");
Path path = FileSystems.getDefault().getPath(cmdArgs.outputCurlScript);
Files.copy(scriptStream, path, StandardCopyOption.REPLACE_EXISTING);
scriptStream.close();
System.out.printf("Wrote script to: %s\n", path.toFile().getAbsolutePath());
System.exit(0);
}
GreetingAuthzClient client = new GreetingAuthzClient();
client.init(cmdArgs);
System.out.printf("\nRequesting greeting...\n");
Greeting greeting = client.getGreeting(cmdArgs.app, cmdArgs.from);
System.out.printf("%s\n", greeting);
}
示例9: main
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
public static void main(String[] args) {
ShotgunWSD shotgunWSD = new ShotgunWSD();
try {
new JCommander(shotgunWSD, args);
shotgunWSD.run();
} catch(ParameterException e) {
String[] helpArgs = {"--help"};
JCommander jCommander = new JCommander(shotgunWSD, helpArgs);
jCommander.setProgramName("ShotgunWSD");
jCommander.usage();
}
}
示例10: createCommander
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
private static JCommander createCommander(CommandContainer commandContainer, String[] args) {
JCommander.Builder builder = JCommander.newBuilder();
for (String operation : commandContainer.getAllCommands()) {
CommandContainer.Command command = commandContainer.getCommand(operation);
builder.addCommand(operation, command);
}
JCommander commander = builder.build();
commander.setProgramName("stf");
commander.setCaseSensitiveOptions(false);
commander.parseWithoutValidation(args);
return commander;
}
示例11: main
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
ConversationUtility conversationCmd = new ConversationUtility();
JCommander jCommander = new JCommander(conversationCmd);
jCommander.setProgramName("Watson Conversation Globalization");
jCommander.addCommand("help", new HelpCmd());
jCommander.addCommand("WCS_To_GP", new WCS_To_GP(), "wcs_to_gp");
jCommander.addCommand("GP_To_WCS", new GP_To_WCS(), "gp_to_wcs");
try {
jCommander.parse(args);
String parsedCommand = jCommander.getParsedCommand();
System.out.println(parsedCommand);
if (parsedCommand == null || parsedCommand.equalsIgnoreCase("help")) {
jCommander.usage();
} else {
BaseUtility parsedCmd = (BaseUtility) jCommander.getCommands().get(parsedCommand).getObjects().get(0);
parsedCmd.execute();
}
} catch (ParameterException e) {
System.err.println(e.getMessage());
jCommander.usage();
System.exit(1);
}
}
示例12: printUsageAndExit
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
void printUsageAndExit(int exitCode, CliArguments cliArguments) {
StringBuilder out = new StringBuilder();
JCommander jCommander = new JCommander(cliArguments);
jCommander.setProgramName("java -jar " + jarName());
jCommander.usage(out);
System.err.println(out);
System.exit(exitCode);
}
示例13: parseCommandLine
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
private void parseCommandLine(String [] args) {
JCommander cmd = new JCommander(this, args);
cmd.setProgramName(COMMAND_NAME);
if(help) {
cmd.usage();
System.exit(0);
}
}
示例14: parse
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
public static Options parse(String[] cliArgs) {
Options args = new Options();
JCommander jc = JCommander.newBuilder()
.addObject(args)
.build();
jc.parse(cliArgs);
if(args.help){
jc.setProgramName("dremio-admin clean");
jc.usage();
}
return args;
}
示例15: OntoNotesConverter
import com.beust.jcommander.JCommander; //导入方法依赖的package包/类
private OntoNotesConverter(String... args) {
JCommander cmd = new JCommander(this);
cmd.setProgramName(this.getClass().getSimpleName());
try {
cmd.parse(args);
} catch (ParameterException e) {
System.err.println(e.getMessage());
cmd.usage();
System.exit(1);
}
}