public static void main(String... args) throws Exception { ArgumentParser parser = ArgumentParsers.newFor("SynthesizeFile").build() .defaultHelp(true) .description("Synthesize a text file or ssml file."); MutuallyExclusiveGroup group = parser.addMutuallyExclusiveGroup().required(true); group.addArgument("--text").help("The text file from which to synthesize speech."); group.addArgument("--ssml").help("The ssml file from which to synthesize speech."); try { Namespace namespace = parser.parseArgs(args); if (namespace.get("text") != null) { synthesizeTextFile(namespace.getString("text")); } else { synthesizeSsmlFile(namespace.getString("ssml")); } } catch (ArgumentParserException e) { parser.handleError(e); } } }
public static void main(String... args) throws Exception { ArgumentParser parser = ArgumentParsers.newFor("SynthesizeText") .build() .defaultHelp(true) .description("Synthesize a text or ssml."); MutuallyExclusiveGroup group = parser.addMutuallyExclusiveGroup().required(true); group.addArgument("--text").help("The text file from which to synthesize speech."); group.addArgument("--ssml").help("The ssml file from which to synthesize speech."); try { Namespace namespace = parser.parseArgs(args); if (namespace.get("text") != null) { synthesizeText(namespace.getString("text")); } else { synthesizeSsml(namespace.getString("ssml")); } } catch (ArgumentParserException e) { parser.handleError(e); } } }
parser.addMutuallyExclusiveGroup("input data") .description("Specify the input data for the command.") .required(required); ArgumentGroup options = parser.addArgumentGroup("input options") .description("Additional options for input data.");
.description("Takes FullConfig xml file and resolves expressions inside using global config file - used mainly for TED instances"); argParser.addArgument("-fullconfig").type(String.class).required(true).help("Path to fullconfig that should be resolved."); MutuallyExclusiveGroup addMutuallyExclusiveGroup = argParser.addMutuallyExclusiveGroup().required(true); addMutuallyExclusiveGroup.addArgument("-fullconfigout").type(String.class).help("Path to output file with resolved full config."); EmptyArgumentAction onlyValidateAction = new EmptyArgumentAction();
.required(false);