This implementation assumes text contains only narrow characters,
The width is just simply the length of given text. The application code should not use this class directly.
137138139140141142143
boolean addHelp, String prefixChars, String fromFilePrefix) { return new ArgumentParserImpl(prog, addHelp, prefixChars, fromFilePrefix, cjkWidthHack_ && cjkWidthLangs_.contains(Locale.getDefault() .getLanguage()) ? new CJKTextWidthCounter() : new ASCIITextWidthCounter()); }
87888990919293
private static final Pattern SHORT_OPTS_PATTERN = Pattern .compile("-[^-].*"); public ArgumentParserImpl(String prog) { this(prog, true, ArgumentParsers.DEFAULT_PREFIX_CHARS, null, new ASCIITextWidthCounter(), null, null); }
92939495969798
new ASCIITextWidthCounter(), null, null); } public ArgumentParserImpl(String prog, boolean addHelp) { this(prog, addHelp, ArgumentParsers.DEFAULT_PREFIX_CHARS, null, new ASCIITextWidthCounter(), null, null); }
96979899100101102103
this(prog, addHelp, ArgumentParsers.DEFAULT_PREFIX_CHARS, null, new ASCIITextWidthCounter(), null, null); } public ArgumentParserImpl(String prog, boolean addHelp, String prefixChars) { this(prog, addHelp, prefixChars, null, new ASCIITextWidthCounter(), null, null); }
103104105106107108109
} public ArgumentParserImpl(String prog, boolean addHelp, String prefixChars, String fromFilePrefix) { this(prog, addHelp, prefixChars, fromFilePrefix, new ASCIITextWidthCounter(), null, null); }
7778798081828384858687
title = "-" + title; // prefer "--libjars" long arg style over "-libjars" style but retain "-D foo" short arg style } String help = line.substring(i, line.length()).trim(); StringWriter strWriter = new StringWriter(); PrintWriter writer = new PrintWriter(strWriter, true); TextHelper.printHelp(writer, title, help, new ASCIITextWidthCounter(), ArgumentParsers.getFormatWidth()); result.append(strWriter.toString()); } } } }
7879808182838485868788