@Test public void testResolveMetavar() { ArgumentImpl arg = new ArgumentImpl(config_, "--foo"); assertEquals("FOO", arg.resolveMetavar()[0]); arg.dest("bar"); assertEquals("BAR", arg.resolveMetavar()[0]); arg.choices("alpha", "bravo"); assertEquals("{alpha,bravo}", arg.resolveMetavar()[0]); arg.metavar("baz"); assertEquals("baz", arg.resolveMetavar()[0]); arg = new ArgumentImpl(config_, "foo"); assertEquals("foo", arg.resolveMetavar()[0]); arg.dest("bar"); assertEquals("bar", arg.resolveMetavar()[0]); arg.choices("alpha", "bravo"); assertEquals("{alpha,bravo}", arg.resolveMetavar()[0]); arg.metavar("baz"); assertEquals("baz", arg.resolveMetavar()[0]); }
String[] resolveMetavar() { if (metavar_ == null) { if (choice_ == null) { if (type_ instanceof MetavarInference) { String[] metavar = ((MetavarInference) type_) .inferMetavar(); if (metavar != null) { return metavar; } } if (isNamedArgument()) { return new String[] { dest_.toUpperCase() }; } return new String[] { dest_ }; } return new String[] { choice_.textualFormat() }; } return metavar_; }
ArgumentImpl implements Argument { String[] resolveMetavar() { if (metavar_ == null) { if (choice_ == null) { if (type_ instanceof MetavarInference) { String[] metavar = ((MetavarInference) type_) .inferMetavar(); if (metavar != null) { return metavar; } } if (isNamedArgument()) { return new String[] { dest_.toUpperCase() }; } return new String[] { dest_ }; } return new String[] { choice_.textualFormat() }; } return metavar_; } }
ArgumentImpl implements Argument { String[] resolveMetavar() { if (metavar_ == null) { if (choice_ == null) { if (type_ instanceof MetavarInference) { String[] metavar = ((MetavarInference) type_) .inferMetavar(); if (metavar != null) { return metavar; } } if (isNamedArgument()) { return new String[] { dest_.toUpperCase() }; } return new String[] { dest_ }; } return new String[] { choice_.textualFormat() }; } return metavar_; } ArgumentImpl(ArgumentParserConfigurationImpl config,
            String... nameOrFlags);   ArgumentImpl(ArgumentParserConfigurationImpl config,
            ArgumentGroupImpl argumentGroup, String... nameOrFlags); }
ArgumentImpl implements Argument { String[] resolveMetavar() { if (metavar_ == null) { if (choice_ == null) { if (type_ instanceof MetavarInference) { String[] metavar = ((MetavarInference) type_) .inferMetavar(); if (metavar != null) { return metavar; } } if (isNamedArgument()) { return new String[] { dest_.toUpperCase() }; } return new String[] { dest_ }; } return new String[] { choice_.textualFormat() }; } return metavar_; } ArgumentImpl(ArgumentParserConfigurationImpl config,
            String... nameOrFlags);   ArgumentImpl(ArgumentParserConfigurationImpl config,
            ArgumentGroupImpl argumentGroup, String... nameOrFlags); @Override String textualName(); void printHelp(PrintWriter writer, boolean defaultHelp,
            TextWidthCounter textWidthCounter, int width); Object convert(ArgumentParserImpl parser, String value); @Override ArgumentImpl nargs(int n); @Override ArgumentImpl nargs(String n); @Override ArgumentImpl setConst(Object value); @Override ArgumentImpl setConst(E... values); @Override ArgumentImpl setDefault(Object value); @Override ArgumentImpl setDefault(E... values); @Override ArgumentImpl setDefault(FeatureControl ctrl); @Override ArgumentImpl type(Class<T> type); @Override ArgumentImpl type(ArgumentType<T> type); @Override ArgumentImpl required(boolean required); @Override ArgumentImpl action(ArgumentAction action); @Override ArgumentImpl choices(ArgumentChoice choice); @Override ArgumentImpl choices(Collection<E> values); @Override ArgumentImpl choices(E... values); @Override ArgumentImpl dest(String dest); @Override ArgumentImpl metavar(String... metavar); @Override ArgumentImpl help(String help); @Override ArgumentImpl help(FeatureControl ctrl); void run(ArgumentParserImpl parser, Map<String, Object> res,
            String flag, Object value); @Override String getDest(); @Override Object getConst(); @Override Object getDefault(); @Override FeatureControl getDefaultControl(); @Override FeatureControl getHelpControl(); String getName(); boolean isRequired(); String[] getMetavar(); ArgumentAction getAction(); String getHelp(); }
ArgumentImpl implements Argument { String[] resolveMetavar() { if (metavar_ == null) { if (choice_ == null) { if (type_ instanceof MetavarInference) { String[] metavar = ((MetavarInference) type_) .inferMetavar(); if (metavar != null) { return metavar; } } if (isNamedArgument()) { return new String[] { dest_.toUpperCase() }; } return new String[] { dest_ }; } return new String[] { choice_.textualFormat() }; } return metavar_; } ArgumentImpl(ArgumentParserConfigurationImpl config,
            String... nameOrFlags);   ArgumentImpl(ArgumentParserConfigurationImpl config,
            ArgumentGroupImpl argumentGroup, String... nameOrFlags); @Override String textualName(); void printHelp(PrintWriter writer, boolean defaultHelp,
            TextWidthCounter textWidthCounter, int width); Object convert(ArgumentParserImpl parser, String value); @Override ArgumentImpl nargs(int n); @Override ArgumentImpl nargs(String n); @Override ArgumentImpl setConst(Object value); @Override ArgumentImpl setConst(E... values); @Override ArgumentImpl setDefault(Object value); @Override ArgumentImpl setDefault(E... values); @Override ArgumentImpl setDefault(FeatureControl ctrl); @Override ArgumentImpl type(Class<T> type); @Override ArgumentImpl type(ArgumentType<T> type); @Override ArgumentImpl required(boolean required); @Override ArgumentImpl action(ArgumentAction action); @Override ArgumentImpl choices(ArgumentChoice choice); @Override ArgumentImpl choices(Collection<E> values); @Override ArgumentImpl choices(E... values); @Override ArgumentImpl dest(String dest); @Override ArgumentImpl metavar(String... metavar); @Override ArgumentImpl help(String help); @Override ArgumentImpl help(FeatureControl ctrl); void run(ArgumentParserImpl parser, Map<String, Object> res,
            String flag, Object value); @Override String getDest(); @Override Object getConst(); @Override Object getDefault(); @Override FeatureControl getDefaultControl(); @Override FeatureControl getHelpControl(); String getName(); boolean isRequired(); String[] getMetavar(); ArgumentAction getAction(); String getHelp();  }