diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3ec8dfae4..60967cd4c 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -91,7 +91,9 @@ class Fs { ... } - [#720] Bugfix: `@Unmatched` list should be cleared prior to subsequent invocations. - [#723] Bugfix: variables in `defaultValue` were not expanded in usage help option description line for `showDefaultValues = true`. Thanks to [Mikaƫl Barbero](https://github.com/mbarbero) for raising this. - [#722] Bugfix: synopsis of deeply nested `@ArgGroup` shows `@Options` duplicate on outer level of command. Thanks to [Shane Rowatt](https://github.com/srowatt) for raising this. +- [#724] Bugfix: Usage message exceeds width + ## Deprecations diff --git a/src/main/java/picocli/CommandLine.java b/src/main/java/picocli/CommandLine.java index 466efeb6d..a319d333b 100644 --- a/src/main/java/picocli/CommandLine.java +++ b/src/main/java/picocli/CommandLine.java @@ -37,6 +37,7 @@ import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; import picocli.CommandLine.Help.Ansi.IStyle; @@ -13415,8 +13416,8 @@ public static TextTable forDefaultColumns(Ansi ansi, int longOptionsColumnWidth, new Column(2, 0, TRUNCATE), // "*" new Column(2, 0, SPAN), // "-c" new Column(1, 0, TRUNCATE), // "," - new Column(longOptionsColumnWidth, 1, SPAN), // " --create" - new Column(usageHelpWidth - longOptionsColumnWidth, 1, WRAP)); // " Creates a ..." + new Column(longOptionsColumnWidth, 1, SPAN), // " --create" + new Column(usageHelpWidth - 5 - longOptionsColumnWidth, 1, WRAP)); // " Creates a ..." } /** Constructs a new TextTable with columns with the specified width, all SPANning multiple columns on diff --git a/src/test/java/picocli/AutoCompleteTest.java b/src/test/java/picocli/AutoCompleteTest.java index 8f45b0182..f10a84166 100644 --- a/src/test/java/picocli/AutoCompleteTest.java +++ b/src/test/java/picocli/AutoCompleteTest.java @@ -190,25 +190,26 @@ private static String toString(Object obj) { "Usage: picocli.AutoComplete [-fhVw] [-c=] [-n=]%n" + " [-o=] %n" + "Generates a bash completion script for the specified command class.%n" + - " Fully qualified class name of the annotated @Command%n" + - " class to generate a completion script for.%n" + + " Fully qualified class name of the annotated%n" + + " @Command class to generate a completion script%n" + + " for.%n" + " -c, --factory=%n" + - " Optionally specify the fully qualified class name of%n" + - " the custom factory to use to instantiate the command%n" + - " class. When omitted, the default picocli factory is%n" + - " used.%n" + - " -n, --name= Optionally specify the name of the command to create a%n" + - " completion script for. When omitted, the annotated%n" + - " class @Command 'name' attribute is used. If no%n" + - " @Command 'name' attribute exists,%n" + + " Optionally specify the fully qualified class name%n" + + " of the custom factory to use to instantiate the%n" + + " command class. When omitted, the default picocli%n" + + " factory is used.%n" + + " -n, --name= Optionally specify the name of the command to%n" + + " create a completion script for. When omitted,%n" + + " the annotated class @Command 'name' attribute is%n" + + " used. If no @Command 'name' attribute exists,%n" + " '' (in lower-case) is used.%n" + " -o, --completionScript=%n" + - " Optionally specify the path of the completion script%n" + - " file to generate. When omitted, a file named%n" + - " '_completion' is generated in the%n" + - " current directory.%n" + - " -w, --writeCommandScript Write a '' sample command script to the%n" + - " same directory as the completion script.%n" + + " Optionally specify the path of the completion%n" + + " script file to generate. When omitted, a file%n" + + " named '_completion' is generated in%n" + + " the current directory.%n" + + " -w, --writeCommandScript Write a '' sample command script to%n" + + " the same directory as the completion script.%n" + " -f, --force Overwrite existing script files.%n" + " -h, --help Show this help message and exit.%n" + " -V, --version Print version information and exit.%n" + diff --git a/src/test/java/picocli/CommandLineHelpTest.java b/src/test/java/picocli/CommandLineHelpTest.java index 5432d49c9..8e1c505d9 100644 --- a/src/test/java/picocli/CommandLineHelpTest.java +++ b/src/test/java/picocli/CommandLineHelpTest.java @@ -2049,8 +2049,8 @@ public void testTextTableAddsNewRowWhenAnyColumnTooLong() { "--create, --create2, --create3, --create4, --create5, --create6, --create7, --create8", "description"); assertEquals(String.format("" + - "* -c, --create, --create2, --create3, --create4, --create5, --create6, --create7,%n" + - " --create8%n" + + "* -c, --create, --create2, --create3, --create4, --create5, --create6,%n" + + " --create7, --create8%n" + " description%n" ,""), table.toString(new StringBuilder()).toString()); @@ -2059,8 +2059,8 @@ public void testTextTableAddsNewRowWhenAnyColumnTooLong() { "--create, --create2, --create3, --create4, --create5, --create6, --createAA7, --create8", "description"); assertEquals(String.format("" + - " -c, --create, --create2, --create3, --create4, --create5, --create6, --createAA7,%n" + - " --create8%n" + + " -c, --create, --create2, --create3, --create4, --create5, --create6,%n" + + " --createAA7, --create8%n" + " description%n" ,""), table.toString(new StringBuilder()).toString()); } @@ -2795,8 +2795,8 @@ class App { "Usage:
[-P=TIMEUNIT=VALUE[,TIMEUNIT=VALUE...]]... (FIXTAG=VALUE%n" + " [\\|FIXTAG=VALUE...] FIXTAG=VALUE[\\|FIXTAG=VALUE...])...%n" + " (FIXTAG=VALUE[\\|FIXTAG=VALUE...] FIXTAG=VALUE[\\|FIXTAG=VALUE...])...%n" + - " Repeating group of two lists of vertical bar '|'-separated FIXTAG=VALUE%n" + - " pairs.%n" + + " Repeating group of two lists of vertical bar '|'-separated%n" + + " FIXTAG=VALUE pairs.%n" + " -P, -map=TIMEUNIT=VALUE[,TIMEUNIT=VALUE...]%n" + " Any number of TIMEUNIT=VALUE pairs. These may be specified separately%n" + " (-PTIMEUNIT=VALUE) or as a comma-separated list.%n"); @@ -2870,8 +2870,8 @@ class App { " -D=... use value for given property%n" + " --help print this message%n" + " --lib=[,[,]]%n" + - " comma-separated list of up to 3 paths to search for jars%n" + - " and classes%n" + + " comma-separated list of up to 3 paths to search for%n" + + " jars and classes%n" + " --logfile= use given file for log%n" + " -P=[...] use value for project key%n" + " -S=[[,]...]%n" + @@ -3587,11 +3587,11 @@ static class WideDescriptionApp { "The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped%n" + "over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The%n" + "quick brown fox jumped over the lazy dog.%n" + - " -s= The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick%n" + - " brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.%n" + + " -s= The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The%n" + + " quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.%n" + " --very-very-very-looooooooooooooooong-option-name=%n" + - " The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick%n" + - " brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.%n" + " The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The%n" + + " quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.%n" ); } @@ -3737,8 +3737,8 @@ class Args { "Usage:
...%n" + " ... description%n" + " Default:%n" + - " /long/value/length/equals/columnValue/maxlength/and/non/null/offset/%n" + - " xxx%n"); + " /long/value/length/equals/columnValue/maxlength/and/non/null/of%n" + + " fset/xxx%n"); assertEquals(expected, usageString(new Args(), Help.Ansi.OFF)); } @@ -3836,8 +3836,8 @@ class App { String expected = String.format("" + "Usage:
[--excludebase=...]...%n" + " --excludebase=...%n" + - " exclude child files of cTree (only works with --ctree).%%nCurrently must be%n" + - " explicit or with trailing %% for truncated glob.%n"); + " exclude child files of cTree (only works with --ctree).%%nCurrently%n" + + " must be explicit or with trailing %% for truncated glob.%n"); String actual = new CommandLine(new App()).getUsageMessage(); assertEquals(expected, actual); @@ -3920,13 +3920,13 @@ class App { "\u30eb\u7aef\u672b\u5411\u3051OS\u306b\u306f\u6a19\u6e96\u3067\u7528\u610f\u3055\u308c\u3066\u304a\u3089\u305a\u3001GUI\u304c\u4e3b\u6d41\u3068\u306a\u3063\u3066\u3044\u308b\u3002%n" + " -h, --help Show this help message and exit.%n" + " -V, --version Print version information and exit.%n" + - " -x, --long= \u3057\u304b\u3057\u3001GUI\u74b0\u5883\u3067\u3042\u308c\u3070\u30dd\u30a4\u30f3\u30c6\u30a3\u30f3\u30b0\u30c7\u30d0\u30a4\u30b9\u306b\u3088\u308b\u64cd\u4f5c\u3092\u7e70\u308a\u8fd4\u3057%n" + - " \u884c\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3088\u3046\u306a\u7169\u96d1\u306a\u4f5c\u696d\u3092\u3001CUI\u74b0\u5883\u3067\u3042\u308c\u3070\u7c21\u5358\u306a\u30b3%n" + - " \u30de\u30f3\u30c9\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u5b9f\u884c\u3067\u304d\u308b\u5834\u5408\u3082\u3042\u308b\u306a\u3069\u3001CUI\u306b\u3082\u4f9d\u7136\u3068\u3057\u3066%n" + - " \u5229\u70b9\u306f\u3042\u308b\u3002\u7279\u306b\u30a8\u30f3\u30c9\u30e6\u30fc\u30b6\u30fc\u3060\u3051\u3067\u306a\u304f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7ba1\u7406\u8005\u3084\u30bd\u30d5%n" + - " \u30c8\u30a6\u30a7\u30a2\u958b\u767a\u8005\u3082\u5229\u7528\u3059\u308bPC\u3084\u30b5\u30fc\u30d0\u30fc\u306b\u304a\u3044\u3066\u306f\u3001GUI\u3068CUI\u306f\u7528\u9014\u306b%n" + - " \u3088\u3063\u3066\u4f4f\u307f\u5206\u3051\u3066\u4f75\u5b58\u3057\u3066\u3044\u308b\u3082\u306e\u3067\u3042\u308a\u3001CUI\u306f\u5b8c\u5168\u306b\u5ec3\u308c\u305f\u308f\u3051\u3067%n" + - " \u306f\u306a\u3044\u3002%n"); + " -x, --long= \u3057\u304b\u3057\u3001GUI\u74b0\u5883\u3067\u3042\u308c\u3070\u30dd\u30a4\u30f3\u30c6\u30a3\u30f3\u30b0\u30c7\u30d0\u30a4\u30b9\u306b\u3088\u308b\u64cd\u4f5c\u3092\u7e70\u308a%n" + + " \u8fd4\u3057\u884c\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3088\u3046\u306a\u7169\u96d1\u306a\u4f5c\u696d\u3092\u3001CUI\u74b0\u5883\u3067\u3042\u308c\u3070%n" + + " \u7c21\u5358\u306a\u30b3\u30de\u30f3\u30c9\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u5b9f\u884c\u3067\u304d\u308b\u5834\u5408\u3082\u3042\u308b\u306a\u3069\u3001CUI\u306b%n" + + " \u3082\u4f9d\u7136\u3068\u3057\u3066\u5229\u70b9\u306f\u3042\u308b\u3002\u7279\u306b\u30a8\u30f3\u30c9\u30e6\u30fc\u30b6\u30fc\u3060\u3051\u3067\u306a\u304f\u30cd\u30c3\u30c8%n" + + " \u30ef\u30fc\u30af\u7ba1\u7406\u8005\u3084\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u8005\u3082\u5229\u7528\u3059\u308bPC\u3084\u30b5\u30fc\u30d0\u30fc\u306b\u304a%n" + + " \u3044\u3066\u306f\u3001GUI\u3068CUI\u306f\u7528\u9014\u306b\u3088\u3063\u3066\u4f4f\u307f\u5206\u3051\u3066\u4f75\u5b58\u3057\u3066\u3044\u308b\u3082\u306e\u3067%n" + + " \u3042\u308a\u3001CUI\u306f\u5b8c\u5168\u306b\u5ec3\u308c\u305f\u308f\u3051\u3067\u306f\u306a\u3044\u3002%n"); assertEquals(expected, usageMessage); } @@ -3957,10 +3957,10 @@ class App { "\u3066\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u304c\u3001\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306a\u3069\u306e\u30e2\u30d0\u30a4\u30eb\u7aef\u672b\u5411\u3051OS\u306b\u306f\u6a19\u6e96\u3067\u7528\u610f\u3055\u308c\u3066\u304a\u3089\u305a\u3001GUI\u304c\u4e3b\u6d41\u3068\u306a\u3063\u3066\u3044\u308b\u3002%n" + " -h, --help Show this help message and exit.%n" + " -V, --version Print version information and exit.%n" + - " -x, --long= \u3057\u304b\u3057\u3001GUI\u74b0\u5883\u3067\u3042\u308c\u3070\u30dd\u30a4\u30f3\u30c6\u30a3\u30f3\u30b0\u30c7\u30d0\u30a4\u30b9\u306b\u3088\u308b\u64cd\u4f5c\u3092\u7e70\u308a\u8fd4\u3057\u884c\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3088\u3046\u306a\u7169\u96d1\u306a\u4f5c\u696d\u3092\u3001CUI\u74b0\u5883\u3067\u3042\u308c\u3070\u7c21\u5358\u306a%n" + - " \u30b3\u30de\u30f3\u30c9\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u5b9f\u884c\u3067\u304d\u308b\u5834\u5408\u3082\u3042\u308b\u306a\u3069\u3001CUI\u306b\u3082\u4f9d\u7136\u3068\u3057\u3066\u5229\u70b9\u306f\u3042\u308b\u3002\u7279\u306b\u30a8\u30f3\u30c9\u30e6\u30fc\u30b6\u30fc\u3060\u3051\u3067\u306a\u304f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7ba1\u7406\u8005\u3084%n" + - " \u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u8005\u3082\u5229\u7528\u3059\u308bPC\u3084\u30b5\u30fc\u30d0\u30fc\u306b\u304a\u3044\u3066\u306f\u3001GUI\u3068CUI\u306f\u7528\u9014\u306b\u3088\u3063\u3066\u4f4f\u307f\u5206\u3051\u3066\u4f75\u5b58\u3057\u3066\u3044\u308b\u3082\u306e\u3067\u3042\u308a\u3001CUI\u306f\u5b8c\u5168%n" + - " \u306b\u5ec3\u308c\u305f\u308f\u3051\u3067\u306f\u306a\u3044\u3002%n"); + " -x, --long= \u3057\u304b\u3057\u3001GUI\u74b0\u5883\u3067\u3042\u308c\u3070\u30dd\u30a4\u30f3\u30c6\u30a3\u30f3\u30b0\u30c7\u30d0\u30a4\u30b9\u306b\u3088\u308b\u64cd\u4f5c\u3092\u7e70\u308a\u8fd4\u3057\u884c\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3088\u3046\u306a\u7169\u96d1\u306a\u4f5c\u696d\u3092\u3001CUI\u74b0\u5883\u3067\u3042%n" + + " \u308c\u3070\u7c21\u5358\u306a\u30b3\u30de\u30f3\u30c9\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u5b9f\u884c\u3067\u304d\u308b\u5834\u5408\u3082\u3042\u308b\u306a\u3069\u3001CUI\u306b\u3082\u4f9d\u7136\u3068\u3057\u3066\u5229\u70b9\u306f\u3042\u308b\u3002\u7279\u306b\u30a8\u30f3\u30c9\u30e6\u30fc\u30b6\u30fc\u3060\u3051\u3067\u306a\u304f%n" + + " \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7ba1\u7406\u8005\u3084\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u8005\u3082\u5229\u7528\u3059\u308bPC\u3084\u30b5\u30fc\u30d0\u30fc\u306b\u304a\u3044\u3066\u306f\u3001GUI\u3068CUI\u306f\u7528\u9014\u306b\u3088\u3063\u3066\u4f4f\u307f\u5206\u3051\u3066\u4f75\u5b58\u3057%n" + + " \u3066\u3044\u308b\u3082\u306e\u3067\u3042\u308a\u3001CUI\u306f\u5b8c\u5168\u306b\u5ec3\u308c\u305f\u308f\u3051\u3067\u306f\u306a\u3044\u3002%n"); assertEquals(expected, usageMessage); } diff --git a/src/test/java/picocli/CommandLineTest.java b/src/test/java/picocli/CommandLineTest.java index 8ec44d214..6add69e00 100644 --- a/src/test/java/picocli/CommandLineTest.java +++ b/src/test/java/picocli/CommandLineTest.java @@ -2105,8 +2105,8 @@ class App { String expectedOutput = "Usage:
[--foo-bar-baz=]\n" + " --foo-bar-baz= Default:\n" + - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + - " aaaaaaaaaaaaaaaaaaaaaaaaaa\n"; + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"; assertEquals(expectedOutput, content); } diff --git a/src/test/java/picocli/CompletionCandidatesTest.java b/src/test/java/picocli/CompletionCandidatesTest.java index dbef4a4a2..c08fb2924 100644 --- a/src/test/java/picocli/CompletionCandidatesTest.java +++ b/src/test/java/picocli/CompletionCandidatesTest.java @@ -191,21 +191,22 @@ class App { " --boolT Boolean variable 2. Default: true%n" + " --enum= Enum. Values: java, kotlin, groovy, javascript, frege,%n" + " clojure%n" + - " --lib= comma-separated list of up to 3 paths to search for jars%n" + - " and classes. Some example values: This, is, a, very,%n" + - " long, list, of, completion, candidates, that, is,%n" + - " intended, to, wrap, to, the, next, line., I, wonder, if,%n" + - " it, is, long, enough.%n" + - " --logfile= Use given file for log. Default: %s%n" + - " -P=[...] Use value for project key.%n" + - " Default={key1=veryveryverylonglonglongvaluevaluevalue,%n" + - " key2=very2very2very2longlonglongvaluevaluevalue2,%n" + - " key3=very3very3very3longlonglongvaluevaluevalue3}%n" + + " --lib= comma-separated list of up to 3 paths to search for%n" + + " jars and classes. Some example values: This, is, a,%n" + + " very, long, list, of, completion, candidates, that,%n" + + " is, intended, to, wrap, to, the, next, line., I,%n" + + " wonder, if, it, is, long, enough.%n" + + " --logfile= Use given file for log. Default: \\a\\b\\c%n" + + " -P=[...] Use value for project key.%n" + + " Default={key1=veryveryverylonglonglongvaluevaluevalue,%n" + + " key2=very2very2very2longlonglongvaluevaluevalue2,%n" + + " key3=very3very3very3longlonglongvaluevaluevalue3}%n" + " --strNull= String without default. Default: null%n" + - " --x=[,...] Comma-separated list of some xxx's. Valid values: A, B, C, D%n" + - " --y= Test long default. Default: This is a very long default%n" + - " value that is intended to wrap to the next line. I wonder%n" + - " if it is long enough.%n", new File("/a/b/c")); + " --x=[,...] Comma-separated list of some xxx's. Valid values: A,%n" + + " B, C, D%n" + + " --y= Test long default. Default: This is a very long%n" + + " default value that is intended to wrap to the next%n" + + " line. I wonder if it is long enough.%n"); String actual = usageString(new CommandLine(new App(), new InnerClassFactory(this)), CommandLine.Help.Ansi.OFF); assertEquals(expected, actual); } @@ -222,8 +223,8 @@ class EnumTest { } String expected = String.format("" + "Usage:
[-single=] [-list=]...%n" + - " -list= Multiple languages. Valid values: java, kotlin, groovy,%n" + - " javascript, frege, clojure%n" + + " -list= Multiple languages. Valid values: java, kotlin,%n" + + " groovy, javascript, frege, clojure%n" + " -single= Single language. Valid values: java, kotlin, groovy,%n" + " javascript, frege, clojure%n"); assertEquals(expected, new CommandLine(new EnumTest()).getUsageMessage()); diff --git a/src/test/java/picocli/Demo.java b/src/test/java/picocli/Demo.java index fa7246bdb..4198f0a93 100644 --- a/src/test/java/picocli/Demo.java +++ b/src/test/java/picocli/Demo.java @@ -533,7 +533,8 @@ public void testUsageSubCommandStatus() { throw new InternalError(ex.toString()); } } - static final String EXPECTED_USAGE_GITSTATUS = "Show the working tree status.%n" + + static final String EXPECTED_USAGE_GITSTATUS = + "Show the working tree status.%n" + "Usage: git-status [...] [--] [...]%n" + "Displays paths that have differences between the index file and the current%n" + "HEAD commit, paths that have differences between the working tree and the index%n" + @@ -541,12 +542,14 @@ public void testUsageSubCommandStatus() { "ignored by gitignore(5)). The first are what you would commit by running git%n" + "commit; the second and third are what you could commit by running git add%n" + "before running git commit.%n" + - " -b, --branch Show the branch and tracking info even in short-format%n" + + " -b, --branch Show the branch and tracking info even in%n" + + " short-format%n" + " --ignored Show ignored files as well%n" + " -s, --short Give the output in the short-format%n" + " -u, --untracked= Show untracked files.%n" + - " The mode parameter is optional (defaults to `all`), and%n" + - " is used to specify the handling of untracked files.%n" + + " The mode parameter is optional (defaults to `all`),%n" + + " and is used to specify the handling of untracked%n" + + " files.%n" + " The possible options are:%n" + " * no - Show no untracked files.%n" + " * normal - Shows untracked files and directories.%n" + @@ -562,12 +565,14 @@ public void testUsageSubCommandStatus() { "ignored by gitignore(5)). The first are what you would commit by running git%n" + "commit; the second and third are what you could commit by running git add%n" + "before running git commit.%n" + - " @|yellow -b|@, @|yellow --branch|@ Show the branch and tracking info even in short-format%n" + + " @|yellow -b|@, @|yellow --branch|@ Show the branch and tracking info even in%n" + + " short-format%n" + " @|yellow --ignored|@ Show ignored files as well%n" + " @|yellow -s|@, @|yellow --short|@ Give the output in the short-format%n" + " @|yellow -u|@, @|yellow --untracked|@=@|italic |@ Show untracked files.%n" + - " The mode parameter is optional (defaults to `all`), and%n" + - " is used to specify the handling of untracked files.%n" + + " The mode parameter is optional (defaults to `all`),%n" + + " and is used to specify the handling of untracked%n" + + " files.%n" + " The possible options are:%n" + " * @|yellow no|@ - Show no untracked files.%n" + " * @|yellow normal|@ - Shows untracked files and directories.%n" + @@ -586,7 +591,8 @@ public void testUsageSubCommandCommit() { throw new InternalError(ex.toString()); } } - static final String EXPECTED_USAGE_GITCOMMIT = "Usage:%n" + + static final String EXPECTED_USAGE_GITCOMMIT = "" + + "Usage:%n" + "%n" + "Record changes to the repository.%n" + "%n" + @@ -602,30 +608,30 @@ public void testUsageSubCommandCommit() { " [...] the files to commit%n" + "%n" + "Options:%n" + - " -a, --all Tell the command to automatically stage files that have%n" + - " been modified and deleted, but new files you have not%n" + - " told Git about are not affected.%n" + - " -p, --patch Use the interactive patch selection interface to chose%n" + - " which changes to commit%n" + + " -a, --all Tell the command to automatically stage files that%n" + + " have been modified and deleted, but new files you%n" + + " have not told Git about are not affected.%n" + + " -p, --patch Use the interactive patch selection interface to%n" + + " chose which changes to commit%n" + " -C, --reuse-message=%n" + - " Take an existing commit object, and reuse the log message%n" + - " and the authorship information (including the timestamp)%n" + - " when creating the commit.%n" + + " Take an existing commit object, and reuse the log%n" + + " message and the authorship information (including%n" + + " the timestamp) when creating the commit.%n" + " -c, --reedit-message=%n" + - " Like -C, but with -c the editor is invoked, so that the%n" + - " user canfurther edit the commit message.%n" + + " Like -C, but with -c the editor is invoked, so that%n" + + " the user canfurther edit the commit message.%n" + " --fixup= Construct a commit message for use with rebase%n" + " --autosquash.%n" + " --squash= Construct a commit message for use with rebase%n" + - " --autosquash. The commitmessage subject line is taken%n" + - " from the specified commit with a prefix of \"squash! \".%n" + - " Can be used with additional commit message options%n" + - " (-m/-c/-C/-F).%n" + - " -F, --file= Take the commit message from the given file. Use - to read%n" + - " the message from the standard input.%n" + - " -m, --message= Use the given as the commit message. If multiple -m%n" + - " options are given, their values are concatenated as%n" + - " separate paragraphs.%n"; + " --autosquash. The commitmessage subject line is%n" + + " taken from the specified commit with a prefix of%n" + + " \"squash! \". Can be used with additional commit%n" + + " message options (-m/-c/-C/-F).%n" + + " -F, --file= Take the commit message from the given file. Use - to%n" + + " read the message from the standard input.%n" + + " -m, --message= Use the given as the commit message. If%n" + + " multiple -m options are given, their values are%n" + + " concatenated as separate paragraphs.%n"; static final String EXPECTED_USAGE_GITCOMMIT_ANSI = "@|bold,underline Usage:|@%n" + "%n" + @@ -643,30 +649,30 @@ public void testUsageSubCommandCommit() { " [@|yellow |@...] the files to commit%n" + "%n" + "@|bold,underline Options:|@%n" + - " @|yellow -a|@, @|yellow --all|@ Tell the command to automatically stage files that have%n" + - " been modified and deleted, but new files you have not%n" + - " told Git about are not affected.%n" + - " @|yellow -p|@, @|yellow --patch|@ Use the interactive patch selection interface to chose%n" + - " which changes to commit%n" + + " @|yellow -a|@, @|yellow --all|@ Tell the command to automatically stage files that%n" + + " have been modified and deleted, but new files you%n" + + " have not told Git about are not affected.%n" + + " @|yellow -p|@, @|yellow --patch|@ Use the interactive patch selection interface to%n" + + " chose which changes to commit%n" + " @|yellow -C|@, @|yellow --reuse-message|@=@|italic |@%n" + - " Take an existing commit object, and reuse the log message%n" + - " and the authorship information (including the timestamp)%n" + - " when creating the commit.%n" + + " Take an existing commit object, and reuse the log%n" + + " message and the authorship information (including%n" + + " the timestamp) when creating the commit.%n" + " @|yellow -c|@, @|yellow --reedit-message|@=@|italic |@%n" + - " Like -C, but with -c the editor is invoked, so that the%n" + - " user canfurther edit the commit message.%n" + + " Like -C, but with -c the editor is invoked, so that%n" + + " the user canfurther edit the commit message.%n" + " @|yellow --fixup|@=@|italic |@ Construct a commit message for use with rebase%n" + " --autosquash.%n" + " @|yellow --squash|@=@|italic |@ Construct a commit message for use with rebase%n" + - " --autosquash. The commitmessage subject line is taken%n" + - " from the specified commit with a prefix of \"squash! \".%n" + - " Can be used with additional commit message options%n" + - " (-m/-c/-C/-F).%n" + - " @|yellow -F|@, @|yellow --file|@=@|italic |@ Take the commit message from the given file. Use - to read%n" + - " the message from the standard input.%n" + - " @|yellow -m|@, @|yellow --message|@=@|italic |@ Use the given as the commit message. If multiple -m%n" + - " options are given, their values are concatenated as%n" + - " separate paragraphs.%n"; + " --autosquash. The commitmessage subject line is%n" + + " taken from the specified commit with a prefix of%n" + + " \"squash! \". Can be used with additional commit%n" + + " message options (-m/-c/-C/-F).%n" + + " @|yellow -F|@, @|yellow --file|@=@|italic |@ Take the commit message from the given file. Use - to%n" + + " read the message from the standard input.%n" + + " @|yellow -m|@, @|yellow --message|@=@|italic |@ Use the given as the commit message. If%n" + + " multiple -m options are given, their values are%n" + + " concatenated as separate paragraphs.%n"; static // tag::CheckSum[] diff --git a/src/test/java/picocli/I18nTest.java b/src/test/java/picocli/I18nTest.java index c3a9b40d1..0c60a7fca 100644 --- a/src/test/java/picocli/I18nTest.java +++ b/src/test/java/picocli/I18nTest.java @@ -576,7 +576,8 @@ public void testCommandMethodWithResources() { String pushUsage = String.format("" + "Usage: git push [-f] [--tags] %n" + "Update remote refs along with associated objects%n" + - " The \"remote\" repository that is destination of a push operation.%n" + + " The \"remote\" repository that is destination of a push%n" + + " operation.%n" + " -f, --force Disable checks.%n" + " --tags All refs under refs/tags are pushed.%n"); assertEquals(pushUsage, git.getSubcommands().get("push").getUsageMessage()); @@ -594,7 +595,8 @@ public void testLocalizeBuiltInHelp_Shared() { "Shared description 2%n" + " [COMMAND...] Shared description of COMMAND parameter of built-in help%n" + " subcommand%n" + - " -h, --help Shared description of --help option of built-in help subcommand%n" + + " -h, --help Shared description of --help option of built-in help%n" + + " subcommand%n" + "Shared Exit Codes Heading%n" + "These exit codes are blah blah etc.%n" + " 00 (From shared bundle) Normal termination%n" + @@ -626,8 +628,8 @@ public void testLocalizeBuiltInHelp_Specialized() { "Shared description 0%n" + "Shared description 1%n" + "Shared description 2%n" + - " [COMMAND...] Specialized description of COMMAND parameter of i18-top help%n" + - " subcommand%n" + + " [COMMAND...] Specialized description of COMMAND parameter of i18-top%n" + + " help subcommand%n" + " -h, --help Specialized description of --help option of i18-top help%n" + " subcommand%n" + "Shared Exit Codes Heading%n" +