Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

strings' externalization - simple step to multi-lingual options help #22

Closed
wants to merge 3 commits into from

1 participant

El Kodus
El Kodus

It is nice to have.
You'll give non English native speakers easier way to show help descriptors in their native languages (by changing messages.properties only).

El Kodus

There is cleaner, single commit: fd647c9576

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
10 src/main/java/joptsimple/BuiltinHelpFormatter.java
@@ -46,9 +46,9 @@ a copy of this software and associated documentation files (the
46 46
47 47 public String format( Map<String, ? extends OptionDescriptor> options ) {
48 48 if ( options.isEmpty() )
49   - return "No options specified";
  49 + return Messages.getString( "BuiltinHelpFormatter.noOptionsSpecified" );
50 50
51   - grid = new ColumnarData( optionHeader( options ), "Description" );
  51 + grid = new ColumnarData( optionHeader( options ), Messages.getString( "BuiltinHelpFormatter.description" ) );
52 52
53 53 Comparator<OptionDescriptor> comparator =
54 54 new Comparator<OptionDescriptor>() {
@@ -69,10 +69,10 @@ public int compare( OptionDescriptor first, OptionDescriptor second ) {
69 69 private String optionHeader( Map<String, ? extends OptionDescriptor> options ) {
70 70 for ( OptionDescriptor each : options.values() ) {
71 71 if ( each.isRequired() )
72   - return "Option (* = required)";
  72 + return Messages.getString( "BuiltinHelpFormatter.optionRequired" );
73 73 }
74 74
75   - return "Option";
  75 + return Messages.getString( "BuiltinHelpFormatter.option" );
76 76 }
77 77
78 78 private void addHelpLineFor( OptionDescriptor descriptor ) {
@@ -131,7 +131,7 @@ private String createDescriptionDisplay( OptionDescriptor descriptor ) {
131 131 return descriptor.description();
132 132
133 133 String defaultValuesDisplay = createDefaultValuesDisplay( defaultValues );
134   - return descriptor.description() + ' ' + surround( "default: " + defaultValuesDisplay, '(', ')' );
  134 + return descriptor.description() + ' ' + surround( Messages.getString( "BuiltinHelpFormatter.default" ) + defaultValuesDisplay, '(', ')' );
135 135 }
136 136
137 137 private String createDefaultValuesDisplay( List<?> defaultValues ) {
22 src/main/java/joptsimple/Messages.java
... ... @@ -0,0 +1,22 @@
  1 +package joptsimple;
  2 +
  3 +import java.util.Locale;
  4 +import java.util.MissingResourceException;
  5 +import java.util.ResourceBundle;
  6 +
  7 +public class Messages {
  8 + private static final String BUNDLE_NAME = "joptsimple.messages";
  9 +
  10 + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME, Locale.getDefault() );
  11 +
  12 + private Messages() {
  13 + }
  14 +
  15 + public static String getString( String key ) {
  16 + try {
  17 + return RESOURCE_BUNDLE.getString( key );
  18 + } catch ( MissingResourceException e ) {
  19 + return '!' + key + '!';
  20 + }
  21 + }
  22 +}
5 src/main/java/joptsimple/messages.properties
... ... @@ -0,0 +1,5 @@
  1 +BuiltinHelpFormatter.default=default:
  2 +BuiltinHelpFormatter.description=Description
  3 +BuiltinHelpFormatter.noOptionsSpecified=No options specified
  4 +BuiltinHelpFormatter.option=Option
  5 +BuiltinHelpFormatter.optionRequired=Option (* = required)
5 src/main/java/joptsimple/messages_en_US.properties
... ... @@ -0,0 +1,5 @@
  1 +BuiltinHelpFormatter.default=default:
  2 +BuiltinHelpFormatter.description=Description
  3 +BuiltinHelpFormatter.noOptionsSpecified=No options specified
  4 +BuiltinHelpFormatter.option=Option
  5 +BuiltinHelpFormatter.optionRequired=Option (* = required)
5 src/main/java/joptsimple/messages_pl_PL.properties
... ... @@ -0,0 +1,5 @@
  1 +BuiltinHelpFormatter.default=domy\u015Blnie:
  2 +BuiltinHelpFormatter.description=Opis
  3 +BuiltinHelpFormatter.noOptionsSpecified=Brak opcji
  4 +BuiltinHelpFormatter.option=Opcja
  5 +BuiltinHelpFormatter.optionRequired=Opcja (* = wymagana)
197 src/test/java/joptsimple/OptionParserHelpTest.java
@@ -21,7 +21,7 @@ a copy of this software and associated documentation files (the
21 21 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 22 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24   -*/
  24 + */
25 25
26 26 package joptsimple;
27 27
@@ -31,6 +31,7 @@ a copy of this software and associated documentation files (the
31 31 import java.util.ArrayList;
32 32 import java.util.Date;
33 33 import java.util.List;
  34 +import java.util.Locale;
34 35 import java.util.Map;
35 36
36 37 import static java.lang.System.*;
@@ -62,6 +63,7 @@ a copy of this software and associated documentation files (the
62 63
63 64 @Before
64 65 public final void createSink() {
  66 + Locale.setDefault( Locale.US );
65 67 sink = new StringWriter();
66 68 }
67 69
@@ -69,7 +71,7 @@ public final void createSink() {
69 71 public void unconfiguredParser() throws Exception {
70 72 parser.printHelpOn( sink );
71 73
72   - assertEquals( "No options specified", sink.toString() );
  74 + assertEquals( Messages.getString( "BuiltinHelpFormatter.noOptionsSpecified" ), sink.toString() );
73 75 }
74 76
75 77 @Test
@@ -78,8 +80,7 @@ public void oneOptionNoArgNoDescription() throws Exception {
78 80
79 81 parser.printHelpOn( sink );
80 82
81   - assertStandardHelpLines(
82   - "--apple " );
  83 + assertStandardHelpLines( "--apple " );
83 84 }
84 85
85 86 @Test
@@ -88,8 +89,7 @@ public void oneOptionNoArgWithDescription() throws Exception {
88 89
89 90 parser.printHelpOn( sink );
90 91
91   - assertStandardHelpLines(
92   - "-a some description " );
  92 + assertStandardHelpLines( "-a some description " );
93 93 }
94 94
95 95 @Test
@@ -99,8 +99,7 @@ public void twoOptionsNoArgWithDescription() throws Exception {
99 99
100 100 parser.printHelpOn( sink );
101 101
102   - assertStandardHelpLines(
103   - "-a some description ",
  102 + assertStandardHelpLines( "-a some description ",
104 103 "--verbose even more description " );
105 104 }
106 105
@@ -110,8 +109,7 @@ public void oneOptionRequiredArgNoDescription() throws Exception {
110 109
111 110 parser.printHelpOn( sink );
112 111
113   - assertStandardHelpLines(
114   - "-a " );
  112 + assertStandardHelpLines( "-a " );
115 113 }
116 114
117 115 @Test
@@ -120,30 +118,26 @@ public void oneOptionRequiredArgNoDescriptionWithType() throws Exception {
120 118
121 119 parser.printHelpOn( sink );
122 120
123   - assertStandardHelpLines(
124   - "-a <Integer> " );
  121 + assertStandardHelpLines( "-a <Integer> " );
125 122 }
126 123
127 124 @Test
128 125 public void oneOptionRequiredArgWithDescription() throws Exception {
129   - parser.accepts( "a", "some value you need" )
130   - .withRequiredArg().describedAs( "numerical" );
  126 + parser.accepts( "a", "some value you need" ).withRequiredArg().describedAs( "numerical" );
131 127
132 128 parser.printHelpOn( sink );
133 129
134   - assertStandardHelpLines(
135   - "-a <numerical> some value you need " );
  130 + assertStandardHelpLines( "-a <numerical> some value you need " );
136 131 }
137 132
138 133 @Test
139 134 public void oneOptionRequiredArgWithDescriptionAndType() throws Exception {
140   - parser.accepts( "a", "some value you need" )
141   - .withRequiredArg().describedAs( "numerical" ).ofType( Integer.class );
  135 + parser.accepts( "a", "some value you need" ).withRequiredArg().describedAs( "numerical" )
  136 + .ofType( Integer.class );
142 137
143 138 parser.printHelpOn( sink );
144 139
145   - assertStandardHelpLines(
146   - "-a <Integer: numerical> some value you need " );
  140 + assertStandardHelpLines( "-a <Integer: numerical> some value you need " );
147 141 }
148 142
149 143 @Test
@@ -152,8 +146,7 @@ public void oneOptionOptionalArgNoDescription() throws Exception {
152 146
153 147 parser.printHelpOn( sink );
154 148
155   - assertStandardHelpLines(
156   - "--threshold " );
  149 + assertStandardHelpLines( "--threshold " );
157 150 }
158 151
159 152 @Test
@@ -162,33 +155,28 @@ public void oneOptionOptionalArgNoDescriptionWithType() throws Exception {
162 155
163 156 parser.printHelpOn( sink );
164 157
165   - assertStandardHelpLines(
166   - "-a [Float] " );
  158 + assertStandardHelpLines( "-a [Float] " );
167 159 }
168 160
169 161 @Test
170 162 public void oneOptionOptionalArgWithDescription() throws Exception {
171   - parser.accepts( "threshold", "some value you need" )
172   - .withOptionalArg().describedAs( "positive integer" );
  163 + parser.accepts( "threshold", "some value you need" ).withOptionalArg().describedAs( "positive integer" );
173 164
174 165 parser.printHelpOn( sink );
175 166
176   - assertStandardHelpLines(
177   - "--threshold [positive integer] some value you need " );
  167 + assertStandardHelpLines( "--threshold [positive integer] some value you need " );
178 168 }
179 169
180 170 @Test
181 171 public void oneOptionOptionalArgWithDescriptionAndType() throws Exception {
182   - parser.accepts( "threshold", "some value you need" )
183   - .withOptionalArg().describedAs( "positive decimal" ).ofType( Double.class );
  172 + parser.accepts( "threshold", "some value you need" ).withOptionalArg().describedAs( "positive decimal" )
  173 + .ofType( Double.class );
184 174
185 175 parser.printHelpOn( sink );
186 176
187   - assertHelpLines(
188   - "Option Description ",
  177 + assertHelpLines( "Option Description ",
189 178 "------ ----------- ",
190   - "--threshold [Double: positive decimal] some value you need ",
191   - "" );
  179 + "--threshold [Double: positive decimal] some value you need ", "" );
192 180 }
193 181
194 182 @Test
@@ -197,8 +185,7 @@ public void alternativeLongOptions() throws Exception {
197 185
198 186 parser.printHelpOn( sink );
199 187
200   - assertStandardHelpLines(
201   - "-W <opt=value> Alternative form of long options " );
  188 + assertStandardHelpLines( "-W <opt=value> Alternative form of long options " );
202 189 }
203 190
204 191 @Test
@@ -207,30 +194,26 @@ public void optionSynonymsWithoutArguments() throws Exception {
207 194
208 195 parser.printHelpOn( sink );
209 196
210   - assertStandardHelpLines(
211   - "-v, --chatty be verbose " );
  197 + assertStandardHelpLines( "-v, --chatty be verbose " );
212 198 }
213 199
214 200 @Test
215 201 public void optionSynonymsWithRequiredArgument() throws Exception {
216   - parser.acceptsAll( asList( "L", "index" ), "set level" )
217   - .withRequiredArg().ofType( Integer.class );
  202 + parser.acceptsAll( asList( "L", "index" ), "set level" ).withRequiredArg().ofType( Integer.class );
218 203
219 204 parser.printHelpOn( sink );
220 205
221   - assertStandardHelpLines(
222   - "-L, --index <Integer> set level " );
  206 + assertStandardHelpLines( "-L, --index <Integer> set level " );
223 207 }
224 208
225 209 @Test
226 210 public void optionSynonymsWithOptionalArgument() throws Exception {
227   - parser.acceptsAll( asList( "d", "since" ), "date filter" )
228   - .withOptionalArg().describedAs( "yyyyMMdd" ).ofType( Date.class );
  211 + parser.acceptsAll( asList( "d", "since" ), "date filter" ).withOptionalArg().describedAs( "yyyyMMdd" )
  212 + .ofType( Date.class );
229 213
230 214 parser.printHelpOn( sink );
231 215
232   - assertStandardHelpLines(
233   - "-d, --since [Date: yyyyMMdd] date filter " );
  216 + assertStandardHelpLines( "-d, --since [Date: yyyyMMdd] date filter " );
234 217 }
235 218
236 219 @Test
@@ -239,8 +222,7 @@ public void optionSynonymsSortedByShortOptionThenLexicographical() throws Except
239 222
240 223 parser.printHelpOn( sink );
241 224
242   - assertStandardHelpLines(
243   - "-v, --chatty, --prolix " );
  225 + assertStandardHelpLines( "-v, --chatty, --prolix " );
244 226 }
245 227
246 228 @Test
@@ -254,8 +236,7 @@ public void writingToOutputStream() throws Exception {
254 236
255 237 // Bug 1956418
256 238 @Test
257   - public void outputStreamFlushedButNotClosedWhenPrintingHelp()
258   - throws Exception {
  239 + public void outputStreamFlushedButNotClosedWhenPrintingHelp() throws Exception {
259 240
260 241 FakeOutputStream fake = new FakeOutputStream();
261 242
@@ -267,16 +248,16 @@ public void outputStreamFlushedButNotClosedWhenPrintingHelp()
267 248
268 249 @Test
269 250 public void bothColumnsExceedingAllocatedWidths() throws Exception {
270   - parser.acceptsAll( asList( "t", "threshold", "cutoff" ),
271   - "a threshold value beyond which a certain level of the application should cease to write logs" )
  251 + parser
  252 + .acceptsAll( asList( "t", "threshold", "cutoff" ),
  253 + "a threshold value beyond which a certain level of the application should cease to write logs" )
272 254 .withRequiredArg()
273 255 .describedAs( "a positive decimal number that will represent the threshold that has been outlined" )
274 256 .ofType( Double.class );
275 257
276 258 parser.printHelpOn( sink );
277 259
278   - assertStandardHelpLines(
279   - "-t, --cutoff, --threshold <Double: a a threshold value beyond which a ",
  260 + assertStandardHelpLines( "-t, --cutoff, --threshold <Double: a a threshold value beyond which a ",
280 261 " positive decimal number that will certain level of the application ",
281 262 " represent the threshold that has should cease to write logs ",
282 263 " been outlined> " );
@@ -285,61 +266,52 @@ public void bothColumnsExceedingAllocatedWidths() throws Exception {
285 266 // Bug 2018262
286 267 @Test
287 268 public void gradleHelp() throws Exception {
288   - parser.acceptsAll( asList( "n", "non-recursive" ),
289   - "Do not execute primary tasks of child projects." );
  269 + parser.acceptsAll( asList( "n", "non-recursive" ), "Do not execute primary tasks of child projects." );
290 270 parser.acceptsAll( singletonList( "S" ),
291 271 "Don't trigger a System.exit(0) for normal termination. Used for Gradle's internal testing." );
292   - parser.acceptsAll( asList( "I", "no-imports" ),
293   - "Disable usage of default imports for build script files." );
  272 + parser.acceptsAll( asList( "I", "no-imports" ), "Disable usage of default imports for build script files." );
294 273 parser.acceptsAll( asList( "u", "no-search-upward" ),
295 274 "Don't search in parent folders for a settings.gradle file." );
296   - parser.acceptsAll( asList( "x", "cache-off" ),
297   - "No caching of compiled build scripts." );
298   - parser.acceptsAll( asList( "r", "rebuild-cache" ),
299   - "Rebuild the cache of compiled build scripts." );
  275 + parser.acceptsAll( asList( "x", "cache-off" ), "No caching of compiled build scripts." );
  276 + parser.acceptsAll( asList( "r", "rebuild-cache" ), "Rebuild the cache of compiled build scripts." );
300 277 parser.acceptsAll( asList( "v", "version" ), "Print version info." );
301   - parser.acceptsAll( asList( "d", "debug" ),
302   - "Log in debug mode (includes normal stacktrace)." );
  278 + parser.acceptsAll( asList( "d", "debug" ), "Log in debug mode (includes normal stacktrace)." );
303 279 parser.acceptsAll( asList( "q", "quiet" ), "Log errors only." );
304   - parser.acceptsAll( asList( "j", "ivy-debug" ),
305   - "Set Ivy log level to debug (very verbose)." );
  280 + parser.acceptsAll( asList( "j", "ivy-debug" ), "Set Ivy log level to debug (very verbose)." );
306 281 parser.acceptsAll( asList( "i", "ivy-quiet" ), "Set Ivy log level to quiet." );
307 282 parser.acceptsAll( asList( "s", "stacktrace" ),
308 283 "Print out the stacktrace also for user exceptions (e.g. compile error)." );
309 284 parser.acceptsAll( asList( "f", "full-stacktrace" ),
310 285 "Print out the full (very verbose) stacktrace for any exceptions." );
311   - parser.acceptsAll( asList( "t", "tasks" ),
312   - "Show list of all available tasks and their dependencies." );
313   - parser.acceptsAll( asList( "p", "project-dir" ),
314   - "Specifies the start dir for Gradle. Defaults to current dir." )
315   - .withRequiredArg().ofType( String.class );
316   - parser.acceptsAll( asList( "g", "gradle-user-home" ),
317   - "Specifies the gradle user home dir." )
318   - .withRequiredArg().ofType( String.class );
319   - parser.acceptsAll( asList( "l", "plugin-properties-file" ),
320   - "Specifies the plugin.properties file." )
  286 + parser.acceptsAll( asList( "t", "tasks" ), "Show list of all available tasks and their dependencies." );
  287 + parser
  288 + .acceptsAll( asList( "p", "project-dir" ), "Specifies the start dir for Gradle. Defaults to current dir." )
321 289 .withRequiredArg().ofType( String.class );
322   - parser.acceptsAll( asList( "b", "buildfile" ),
323   - "Specifies the build file name (also for subprojects). Defaults to build.gradle." )
  290 + parser.acceptsAll( asList( "g", "gradle-user-home" ), "Specifies the gradle user home dir." ).withRequiredArg()
  291 + .ofType( String.class );
  292 + parser.acceptsAll( asList( "l", "plugin-properties-file" ), "Specifies the plugin.properties file." )
324 293 .withRequiredArg().ofType( String.class );
325   - parser.acceptsAll( asList( "D", "systemprop" ),
326   - "Set system property of the JVM (e.g. -Dmyprop=myvalue)." )
  294 + parser
  295 + .acceptsAll( asList( "b", "buildfile" ),
  296 + "Specifies the build file name (also for subprojects). Defaults to build.gradle." ).withRequiredArg()
  297 + .ofType( String.class );
  298 + parser.acceptsAll( asList( "D", "systemprop" ), "Set system property of the JVM (e.g. -Dmyprop=myvalue)." )
327 299 .withRequiredArg().ofType( String.class );
328   - parser.acceptsAll( asList( "P", "projectprop" ),
329   - "Set project property for the build script (e.g. -Pmyprop=myvalue)." )
330   - .withRequiredArg().ofType( String.class );
331   - parser.acceptsAll( asList( "e", "embedded" ),
332   - "Specify an embedded build script." )
333   - .withRequiredArg().ofType( String.class );
334   - parser.acceptsAll( asList( "B", "bootstrap-debug" ),
335   - "Specify a text to be logged at the beginning (e.g. used by Gradle's bootstrap class." )
  300 + parser
  301 + .acceptsAll( asList( "P", "projectprop" ),
  302 + "Set project property for the build script (e.g. -Pmyprop=myvalue)." ).withRequiredArg()
  303 + .ofType( String.class );
  304 + parser.acceptsAll( asList( "e", "embedded" ), "Specify an embedded build script." ).withRequiredArg()
  305 + .ofType( String.class );
  306 + parser
  307 + .acceptsAll( asList( "B", "bootstrap-debug" ),
  308 + "Specify a text to be logged at the beginning (e.g. used by Gradle's bootstrap class." )
336 309 .withRequiredArg().ofType( String.class );
337 310 parser.acceptsAll( asList( "h", "?" ), "Shows this help message" ).forHelp();
338 311
339 312 parser.printHelpOn( sink );
340 313
341   - assertStandardHelpLines(
342   - "-?, -h Shows this help message ",
  314 + assertStandardHelpLines( "-?, -h Shows this help message ",
343 315 "-B, --bootstrap-debug Specify a text to be logged at the ",
344 316 " beginning (e.g. used by Gradle's ",
345 317 " bootstrap class. ",
@@ -384,26 +356,21 @@ public void gradleHelp() throws Exception {
384 356
385 357 @Test
386 358 public void dateConverterShowsDatePattern() throws Exception {
387   - parser.accepts( "date", "a date" ).withRequiredArg()
388   - .withValuesConvertedBy( datePattern( "MM/dd/yy" ) );
  359 + parser.accepts( "date", "a date" ).withRequiredArg().withValuesConvertedBy( datePattern( "MM/dd/yy" ) );
389 360
390 361 parser.printHelpOn( sink );
391 362
392   - assertStandardHelpLines(
393   - "--date <MM/dd/yy> a date " );
  363 + assertStandardHelpLines( "--date <MM/dd/yy> a date " );
394 364 }
395 365
396 366 @Test
397   - public void dateConverterShowsDatePatternInCombinationWithDescription()
398   - throws Exception {
399   - parser.accepts( "date", "a date" ).withOptionalArg()
400   - .describedAs( "your basic date pattern" )
  367 + public void dateConverterShowsDatePatternInCombinationWithDescription() throws Exception {
  368 + parser.accepts( "date", "a date" ).withOptionalArg().describedAs( "your basic date pattern" )
401 369 .withValuesConvertedBy( datePattern( "MM/dd/yy" ) );
402 370
403 371 parser.printHelpOn( sink );
404 372
405   - assertStandardHelpLines(
406   - "--date [MM/dd/yy: your basic date a date ",
  373 + assertStandardHelpLines( "--date [MM/dd/yy: your basic date a date ",
407 374 " pattern] " );
408 375 }
409 376
@@ -415,8 +382,7 @@ public void leavesEmbeddedNewlinesInDescriptionsAlone() throws Exception {
415 382
416 383 parser.printHelpOn( sink );
417 384
418   - assertStandardHelpLines(
419   - "--type Specify the output type. ",
  385 + assertStandardHelpLines( "--type Specify the output type. ",
420 386 " 'raw' = raw data. ",
421 387 " 'java' = java class " );
422 388 }
@@ -427,8 +393,7 @@ public void includesDefaultValueForRequiredOptionArgument() throws Exception {
427 393
428 394 parser.printHelpOn( sink );
429 395
430   - assertStandardHelpLines(
431   - "-a (default: boo) " );
  396 + assertStandardHelpLines( "-a (default: boo) " );
432 397 }
433 398
434 399 @Test
@@ -437,30 +402,27 @@ public void includesDefaultValueForOptionalOptionArgument() throws Exception {
437 402
438 403 parser.printHelpOn( sink );
439 404
440   - assertStandardHelpLines(
441   - "-b [Integer] (default: 5) " );
  405 + assertStandardHelpLines( "-b [Integer] (default: 5) " );
442 406 }
443 407
444 408 @Test
445 409 public void includesDefaultValueForArgumentWithDescription() throws Exception {
446   - parser.accepts( "c", "a quantity" ).withOptionalArg().ofType( BigDecimal.class )
447   - .describedAs( "quantity" ).defaultsTo( TEN );
  410 + parser.accepts( "c", "a quantity" ).withOptionalArg().ofType( BigDecimal.class ).describedAs( "quantity" )
  411 + .defaultsTo( TEN );
448 412
449 413 parser.printHelpOn( sink );
450 414
451   - assertStandardHelpLines(
452   - "-c [BigDecimal: quantity] a quantity (default: 10) " );
  415 + assertStandardHelpLines( "-c [BigDecimal: quantity] a quantity (default: 10) " );
453 416 }
454 417
455 418 @Test
456 419 public void includesListOfDefaultsForArgumentWithDescription() throws Exception {
457   - parser.accepts( "d", "dizzle" ).withOptionalArg().ofType( Integer.class )
458   - .describedAs( "double dizzle" ).defaultsTo( 2, 3, 5, 7 );
  420 + parser.accepts( "d", "dizzle" ).withOptionalArg().ofType( Integer.class ).describedAs( "double dizzle" )
  421 + .defaultsTo( 2, 3, 5, 7 );
459 422
460 423 parser.printHelpOn( sink );
461 424
462   - assertStandardHelpLines(
463   - "-d [Integer: double dizzle] dizzle (default: [2, 3, 5, 7]) " );
  425 + assertStandardHelpLines( "-d [Integer: double dizzle] dizzle (default: [2, 3, 5, 7]) " );
464 426 }
465 427
466 428 @Test
@@ -469,8 +431,7 @@ public void marksRequiredOptionsSpecially() throws Exception {
469 431
470 432 parser.printHelpOn( sink );
471 433
472   - assertStandardHelpLinesWithRequiredIndicator(
473   - "* -e " );
  434 + assertStandardHelpLinesWithRequiredIndicator( "* -e " );
474 435 }
475 436
476 437 @Test
@@ -506,7 +467,7 @@ private void assertStandardHelpLines( String... expectedLines ) {
506 467 addAll( lines, expectedLines );
507 468 lines.add( EMPTY );
508 469
509   - assertHelpLines( lines.toArray( new String[ lines.size() ] ) );
  470 + assertHelpLines( lines.toArray( new String[lines.size()] ) );
510 471 }
511 472
512 473 private void assertStandardHelpLinesWithRequiredIndicator( String... expectedLines ) {
@@ -516,7 +477,7 @@ private void assertStandardHelpLinesWithRequiredIndicator( String... expectedLin
516 477 addAll( lines, expectedLines );
517 478 lines.add( EMPTY );
518 479
519   - assertHelpLines( lines.toArray( new String[ lines.size() ] ) );
  480 + assertHelpLines( lines.toArray( new String[lines.size()] ) );
520 481 }
521 482
522 483 private void assertHelpLines( String... expectedLines ) {

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.