@@ -51,59 +51,6 @@ static void getUsage(Class<? extends OptionsBase> optionsClass, StringBuilder us
5151 }
5252 }
5353
54- /**
55- * Paragraph-fill the specified input text, indenting lines to 'indent' and
56- * wrapping lines at 'width'. Returns the formatted result.
57- */
58- static String paragraphFill (String in , int indent , int width ) {
59- String indentString = " " .repeat (indent );
60- StringBuilder out = new StringBuilder ();
61- String sep = "" ;
62- for (String paragraph : NEWLINE_SPLITTER .split (in )) {
63- // TODO(ccalvarin) break iterators expect hyphenated words to be line-breakable, which looks
64- // funny for --flag
65- BreakIterator boundary = BreakIterator .getLineInstance (); // (factory)
66- boundary .setText (paragraph );
67- out .append (sep ).append (indentString );
68- int cursor = indent ;
69- for (int start = boundary .first (), end = boundary .next ();
70- end != BreakIterator .DONE ;
71- start = end , end = boundary .next ()) {
72- String word =
73- paragraph .substring (start , end ); // (may include trailing space)
74- if (word .length () + cursor > width ) {
75- out .append ('\n' ).append (indentString );
76- cursor = indent ;
77- }
78- out .append (word );
79- cursor += word .length ();
80- }
81- sep = "\n " ;
82- }
83- return out .toString ();
84- }
85-
86- /**
87- * Returns the expansion for an option, if any, regardless of if the expansion is from a function
88- * or is statically declared in the annotation.
89- */
90- private static @ Nullable ImmutableList <String > getExpansionIfKnown (
91- OptionDefinition optionDefinition , OptionsData optionsData ) {
92- Preconditions .checkNotNull (optionDefinition );
93- return optionsData .getEvaluatedExpansion (optionDefinition );
94- }
95-
96- // Placeholder tag "UNKNOWN" is ignored.
97- private static boolean shouldEffectTagBeListed (OptionEffectTag effectTag ) {
98- return !effectTag .equals (OptionEffectTag .UNKNOWN );
99- }
100-
101- // Tags that only apply to undocumented options are excluded.
102- private static boolean shouldMetadataTagBeListed (OptionMetadataTag metadataTag ) {
103- return !metadataTag .equals (OptionMetadataTag .HIDDEN )
104- && !metadataTag .equals (OptionMetadataTag .INTERNAL );
105- }
106-
10754 /** Appends the usage message for a single option-field message to 'usage'. */
10855 static void getUsage (
10956 OptionDefinition optionDefinition ,
@@ -190,6 +137,60 @@ static void getUsage(
190137 }
191138 }
192139
140+ /**
141+ * Paragraph-fill the specified input text, indenting lines to 'indent' and
142+ * wrapping lines at 'width'. Returns the formatted result.
143+ */
144+ static String paragraphFill (String in , int indent , int width ) {
145+ String indentString = " " .repeat (indent );
146+ StringBuilder out = new StringBuilder ();
147+ String sep = "" ;
148+ for (String paragraph : NEWLINE_SPLITTER .split (in )) {
149+ // TODO(ccalvarin) break iterators expect hyphenated words to be line-breakable, which looks
150+ // funny for --flag
151+ BreakIterator boundary = BreakIterator .getLineInstance (); // (factory)
152+ boundary .setText (paragraph );
153+ out .append (sep ).append (indentString );
154+ int cursor = indent ;
155+ for (int start = boundary .first (), end = boundary .next ();
156+ end != BreakIterator .DONE ;
157+ start = end , end = boundary .next ()) {
158+ String word =
159+ paragraph .substring (start , end ); // (may include trailing space)
160+ if (word .length () + cursor > width ) {
161+ out .append ('\n' ).append (indentString );
162+ cursor = indent ;
163+ }
164+ out .append (word );
165+ cursor += word .length ();
166+ }
167+ sep = "\n " ;
168+ }
169+ return out .toString ();
170+ }
171+
172+ /**
173+ * Returns the expansion for an option, if any, regardless of if the expansion is from a function
174+ * or is statically declared in the annotation.
175+ */
176+ @ Nullable
177+ private static ImmutableList <String > getExpansionIfKnown (
178+ OptionDefinition optionDefinition , OptionsData optionsData ) {
179+ Preconditions .checkNotNull (optionDefinition );
180+ return optionsData .getEvaluatedExpansion (optionDefinition );
181+ }
182+
183+ // Placeholder tag "UNKNOWN" is ignored.
184+ private static boolean shouldEffectTagBeListed (OptionEffectTag effectTag ) {
185+ return !effectTag .equals (OptionEffectTag .UNKNOWN );
186+ }
187+
188+ // Tags that only apply to undocumented options are excluded.
189+ private static boolean shouldMetadataTagBeListed (OptionMetadataTag metadataTag ) {
190+ return !metadataTag .equals (OptionMetadataTag .HIDDEN )
191+ && !metadataTag .equals (OptionMetadataTag .INTERNAL );
192+ }
193+
193194 /** Append the usage message for a single option-field message to 'usage'. */
194195 static void getUsageHtml (
195196 OptionDefinition optionDefinition ,
0 commit comments