@Test public void testFormatUsage() { assertEquals(String.format( TextHelper.LOCALE_ROOT, "usage: argparse4j [-h]%n"), ap.formatUsage()); ap.addArgument("-a"); ap.addArgument("-b").required(true); MutuallyExclusiveGroup group = ap.addMutuallyExclusiveGroup("mutex").required(true); group.addArgument("-c").required(true); group.addArgument("-d").required(true); ap.addArgument("file"); assertEquals(String.format( TextHelper.LOCALE_ROOT, "usage: argparse4j [-h] [-a A] -b B (-c C | -d D) file%n"), ap.formatUsage()); Subparser fooSub = ap.addSubparsers().addParser("foo"); fooSub.addArgument("hash"); assertEquals(String.format( TextHelper.LOCALE_ROOT, "usage: argparse4j [-h] [-a A] -b B (-c C | -d D) file {foo} ...%n"), ap.formatUsage()); assertEquals(String.format( TextHelper.LOCALE_ROOT, "usage: argparse4j -b B (-c C | -d D) file foo [-h] hash%n"), fooSub.formatUsage()); Subparser bazSub = fooSub.addSubparsers().addParser("baz"); assertEquals(String.format( TextHelper.LOCALE_ROOT, "usage: argparse4j -b B (-c C | -d D) file foo hash baz [-h]%n"), bazSub.formatUsage()); }
@Override public String formatUsage() { StringWriter writer = new StringWriter(); printUsage(new PrintWriter(writer)); return writer.toString(); }
ArgumentParserImpl implements ArgumentParser { @Override public String formatUsage() { StringWriter writer = new StringWriter(); printUsage(new PrintWriter(writer)); return writer.toString(); } }
ArgumentParserImpl implements ArgumentParser { @Override public String formatUsage() { StringWriter writer = new StringWriter(); printUsage(new PrintWriter(writer)); return writer.toString(); } ArgumentParserImpl(ArgumentParserConfigurationImpl config);  ArgumentParserImpl(ArgumentParserConfigurationImpl config,
            String command, ArgumentParserImpl mainParser); }
ArgumentParserImpl implements ArgumentParser { @Override public String formatUsage() { StringWriter writer = new StringWriter(); printUsage(new PrintWriter(writer)); return writer.toString(); } ArgumentParserImpl(ArgumentParserConfigurationImpl config);  ArgumentParserImpl(ArgumentParserConfigurationImpl config,
            String command, ArgumentParserImpl mainParser); @Override ArgumentImpl addArgument(String... nameOrFlags); ArgumentImpl addArgument(ArgumentGroupImpl group,
            String... nameOrFlags); @Override SubparsersImpl addSubparsers(); @Override ArgumentGroup addArgumentGroup(String title); @Override MutuallyExclusiveGroup addMutuallyExclusiveGroup(); @Override MutuallyExclusiveGroup addMutuallyExclusiveGroup(String title); @Override ArgumentParserImpl usage(String usage); @Override ArgumentParserImpl description(String description); @Override ArgumentParserImpl epilog(String epilog); @Override ArgumentParserImpl version(String version); @Override ArgumentParserImpl defaultHelp(boolean defaultHelp); @Override void printHelp(); @Override void printHelp(PrintWriter writer); @Override String formatHelp(); @Override void printUsage(); @Override void printUsage(PrintWriter writer); @Override String formatUsage(); @Override ArgumentParserImpl setDefault(String dest, Object value); @Override ArgumentParserImpl setDefaults(Map<String, Object> attrs); @Override Object getDefault(String dest); @Override Namespace parseArgsOrFail(String args[]); @Override Namespace parseKnownArgsOrFail(String args[], List<String> unknown); @Override Namespace parseArgs(String args[]); @Override Namespace parseKnownArgs(String args[], List<String> unknown); @Override void parseArgs(String[] args, Map<String, Object> attrs); @Override void parseKnownArgs(String[] args, List<String> unknown,
            Map<String, Object> attrs); @Override void parseArgs(String[] args, Object userData); @Override void parseKnownArgs(String[] args, List<String> unknown,
            Object userData); @Override void parseArgs(String[] args, Map<String, Object> attrs,
            Object userData); @Override void parseKnownArgs(String[] args, List<String> unknown,
            Map<String, Object> attrs, Object userData); void parseArgs(ParseState state, Map<String, Object> attrs); @Override ArgumentParserConfigurationImpl getConfig(); String getProg(); @Override void printVersion(); @Override void printVersion(PrintWriter writer); @Override String formatVersion(); @Override void handleError(ArgumentParserException e); @Override void handleError(ArgumentParserException e, PrintWriter writer); String getCommand(); String getPrefixChars(); String getFromFilePrefixChars(); }
ArgumentParserImpl implements ArgumentParser { @Override public String formatUsage() { StringWriter writer = new StringWriter(); printUsage(new PrintWriter(writer)); return writer.toString(); } ArgumentParserImpl(ArgumentParserConfigurationImpl config);  ArgumentParserImpl(ArgumentParserConfigurationImpl config,
            String command, ArgumentParserImpl mainParser); @Override ArgumentImpl addArgument(String... nameOrFlags); ArgumentImpl addArgument(ArgumentGroupImpl group,
            String... nameOrFlags); @Override SubparsersImpl addSubparsers(); @Override ArgumentGroup addArgumentGroup(String title); @Override MutuallyExclusiveGroup addMutuallyExclusiveGroup(); @Override MutuallyExclusiveGroup addMutuallyExclusiveGroup(String title); @Override ArgumentParserImpl usage(String usage); @Override ArgumentParserImpl description(String description); @Override ArgumentParserImpl epilog(String epilog); @Override ArgumentParserImpl version(String version); @Override ArgumentParserImpl defaultHelp(boolean defaultHelp); @Override void printHelp(); @Override void printHelp(PrintWriter writer); @Override String formatHelp(); @Override void printUsage(); @Override void printUsage(PrintWriter writer); @Override String formatUsage(); @Override ArgumentParserImpl setDefault(String dest, Object value); @Override ArgumentParserImpl setDefaults(Map<String, Object> attrs); @Override Object getDefault(String dest); @Override Namespace parseArgsOrFail(String args[]); @Override Namespace parseKnownArgsOrFail(String args[], List<String> unknown); @Override Namespace parseArgs(String args[]); @Override Namespace parseKnownArgs(String args[], List<String> unknown); @Override void parseArgs(String[] args, Map<String, Object> attrs); @Override void parseKnownArgs(String[] args, List<String> unknown,
            Map<String, Object> attrs); @Override void parseArgs(String[] args, Object userData); @Override void parseKnownArgs(String[] args, List<String> unknown,
            Object userData); @Override void parseArgs(String[] args, Map<String, Object> attrs,
            Object userData); @Override void parseKnownArgs(String[] args, List<String> unknown,
            Map<String, Object> attrs, Object userData); void parseArgs(ParseState state, Map<String, Object> attrs); @Override ArgumentParserConfigurationImpl getConfig(); String getProg(); @Override void printVersion(); @Override void printVersion(PrintWriter writer); @Override String formatVersion(); @Override void handleError(ArgumentParserException e); @Override void handleError(ArgumentParserException e, PrintWriter writer); String getCommand(); String getPrefixChars(); String getFromFilePrefixChars();  }