1 | |
package org.apache.maven.plugin.changelog; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.Iterator; |
5 | |
import java.util.List; |
6 | |
|
7 | |
import org.apache.maven.plugin.AbstractMojo; |
8 | |
import org.apache.maven.plugin.MojoExecutionException; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | 0 | public class HelpMojo |
19 | |
extends AbstractMojo |
20 | |
{ |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
private boolean detail; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
private java.lang.String goal; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
private int lineLength; |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
private int indentSize; |
48 | |
|
49 | |
|
50 | |
|
51 | |
public void execute() |
52 | |
throws MojoExecutionException |
53 | |
{ |
54 | 0 | if ( lineLength <= 0 ) |
55 | |
{ |
56 | 0 | getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." ); |
57 | 0 | lineLength = 80; |
58 | |
} |
59 | 0 | if ( indentSize <= 0 ) |
60 | |
{ |
61 | 0 | getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." ); |
62 | 0 | indentSize = 2; |
63 | |
} |
64 | |
|
65 | 0 | StringBuffer sb = new StringBuffer(); |
66 | |
|
67 | 0 | append( sb, "org.apache.maven.plugins:maven-changelog-plugin:2.2", 0 ); |
68 | 0 | append( sb, "", 0 ); |
69 | |
|
70 | 0 | append( sb, "Maven Changelog Plugin", 0 ); |
71 | 0 | append( sb, "Produce SCM changelog reports.", 1 ); |
72 | 0 | append( sb, "", 0 ); |
73 | |
|
74 | 0 | if ( goal == null || goal.length() <= 0 ) |
75 | |
{ |
76 | 0 | append( sb, "This plugin has 4 goals:", 0 ); |
77 | 0 | append( sb, "", 0 ); |
78 | |
} |
79 | |
|
80 | 0 | if ( goal == null || goal.length() <= 0 || "changelog".equals( goal ) ) |
81 | |
{ |
82 | 0 | append( sb, "changelog:changelog", 0 ); |
83 | 0 | append( sb, "Generate a changelog report.", 1 ); |
84 | 0 | append( sb, "", 0 ); |
85 | 0 | if ( detail ) |
86 | |
{ |
87 | 0 | append( sb, "Available parameters:", 1 ); |
88 | 0 | append( sb, "", 0 ); |
89 | |
|
90 | 0 | append( sb, "basedir", 2 ); |
91 | 0 | append( sb, "Input dir. Directory where the files under SCM control are located.", 3 ); |
92 | 0 | append( sb, "", 0 ); |
93 | |
|
94 | 0 | append( sb, "commentFormat", 2 ); |
95 | 0 | append( sb, "Comment format string used for interrogating the revision control system. Currently only used by the ClearcaseChangeLogGenerator.", 3 ); |
96 | 0 | append( sb, "", 0 ); |
97 | |
|
98 | 0 | append( sb, "connectionType (Default: connection)", 2 ); |
99 | 0 | append( sb, "Allows the user to choose which scm connection to use when connecting to the scm. Can either be \'connection\' or \'developerConnection\'.", 3 ); |
100 | 0 | append( sb, "", 0 ); |
101 | |
|
102 | 0 | append( sb, "dateFormat (Default: yyyy-MM-dd HH:mm:ss)", 2 ); |
103 | 0 | append( sb, "Used to specify the date format of the log entries that are retrieved from your SCM system.", 3 ); |
104 | 0 | append( sb, "", 0 ); |
105 | |
|
106 | 0 | append( sb, "dates", 2 ); |
107 | 0 | append( sb, "Used to specify the absolute date (or list of dates) to start log entries from.", 3 ); |
108 | 0 | append( sb, "", 0 ); |
109 | |
|
110 | 0 | append( sb, "developers", 2 ); |
111 | 0 | append( sb, "List of developers to be shown on the report.", 3 ); |
112 | 0 | append( sb, "", 0 ); |
113 | |
|
114 | 0 | append( sb, "displayChangeSetDetailUrl", 2 ); |
115 | 0 | append( sb, "A template string that is used to create the changeset URL. If not defined no change set link will be created. There is one special token that you can use in your template:\n-\t%REV% - this is the changeset revision\n\nExample: http://fisheye.sourceforge.net/changelog/a-project/?cs=%REV%\n\nNote: If you don\'t supply the %REV% token in your template, the revision will simply be appended to your template URL.\n", 3 ); |
116 | 0 | append( sb, "", 0 ); |
117 | |
|
118 | 0 | append( sb, "displayFileDetailUrl (Default: ${project.scm.url})", 2 ); |
119 | 0 | append( sb, "A template string that is used to create the URL to the file details. There is a special token that you can use in your template:\n-\t%FILE% - this is the path to a file\n\nExample: http://checkstyle.cvs.sourceforge.net/checkstyle%FILE%?view=markup\n\nNote: If you don\'t supply the token in your template, the path of the file will simply be appended to your template URL.\n", 3 ); |
120 | 0 | append( sb, "", 0 ); |
121 | |
|
122 | 0 | append( sb, "displayFileRevDetailUrl", 2 ); |
123 | 0 | append( sb, "A template string that is used to create the revision aware URL to the file details in a similar fashion to the displayFileDetailUrl. When a report contains both file and file revision information, as in the Change Log report, this template string can be used to create a revision aware URL to the file details. If not defined this template string defaults to the same value as the displayFileDetailUrl and thus revision number aware links will not be used. There are two special tokens that you can use in your template:\n-\t%FILE% - this is the path to a file\n-\t%REV% - this is the revision of the file\n\nExample: http://fisheye.sourceforge.net/browse/a-project/%FILE%?r=%REV%\n\nNote: If you don\'t supply the %FILE% token in your template, the path of the file will simply be appended to your template URL.\n", 3 ); |
124 | 0 | append( sb, "", 0 ); |
125 | |
|
126 | 0 | append( sb, "headingDateFormat (Default: yyyy-MM-dd)", 2 ); |
127 | 0 | append( sb, "Used to specify the format to use for the dates in the headings of the report.", 3 ); |
128 | 0 | append( sb, "", 0 ); |
129 | |
|
130 | 0 | append( sb, "issueIDRegexPattern (Default: [a-zA-Z]{2,}-\\d+)", 2 ); |
131 | 0 | append( sb, "A pattern used to identify \'issue tracker\' IDs such as those used by JIRA, Bugzilla and alike in the SCM commit messages. Any matched patterns are replaced with issueLinkUrl URL. The default value is a JIRA-style issue identification pattern.", 3 ); |
132 | 0 | append( sb, "", 0 ); |
133 | |
|
134 | 0 | append( sb, "issueLinkUrl (Default: http://jira.codehaus.org/browse/%ISSUE%)", 2 ); |
135 | 0 | append( sb, "The issue tracker URL used when replacing any matched issueIDRegexPattern found in the SCM commit messages. The default is URL is the codehaus JIRA URL. If %ISSUE% is found in the URL it is replaced with the matched issue ID, otherwise the matched issue ID is appended to the URL.", 3 ); |
136 | 0 | append( sb, "", 0 ); |
137 | |
|
138 | 0 | append( sb, "outputEncoding (Default: ISO-8859-1)", 2 ); |
139 | 0 | append( sb, "Output encoding for the xml document", 3 ); |
140 | 0 | append( sb, "", 0 ); |
141 | |
|
142 | 0 | append( sb, "outputXML", 2 ); |
143 | 0 | append( sb, "Output file for xml document", 3 ); |
144 | 0 | append( sb, "", 0 ); |
145 | |
|
146 | 0 | append( sb, "outputXMLExpiration (Default: 60)", 2 ); |
147 | 0 | append( sb, "Allows the user to make changelog regenerate the changelog.xml file for the specified time in minutes.", 3 ); |
148 | 0 | append( sb, "", 0 ); |
149 | |
|
150 | 0 | append( sb, "passphrase", 2 ); |
151 | 0 | append( sb, "The passphrase (used by java svn).", 3 ); |
152 | 0 | append( sb, "", 0 ); |
153 | |
|
154 | 0 | append( sb, "password", 2 ); |
155 | 0 | append( sb, "The user password (used by svn and starteam protocol).", 3 ); |
156 | 0 | append( sb, "", 0 ); |
157 | |
|
158 | 0 | append( sb, "privateKey", 2 ); |
159 | 0 | append( sb, "The private key (used by java svn).", 3 ); |
160 | 0 | append( sb, "", 0 ); |
161 | |
|
162 | 0 | append( sb, "range (Default: -1)", 2 ); |
163 | 0 | append( sb, "Used to specify the number of days of log entries to retrieve.", 3 ); |
164 | 0 | append( sb, "", 0 ); |
165 | |
|
166 | 0 | append( sb, "scmUrl", 2 ); |
167 | 0 | append( sb, "The URL to view the scm. Basis for external links from the generated report.", 3 ); |
168 | 0 | append( sb, "", 0 ); |
169 | |
|
170 | 0 | append( sb, "systemProperties", 2 ); |
171 | 0 | append( sb, "The system properties to use (needed by the perforce scm provider).", 3 ); |
172 | 0 | append( sb, "", 0 ); |
173 | |
|
174 | 0 | append( sb, "tagBase", 2 ); |
175 | 0 | append( sb, "The url of tags base directory (used by svn protocol).", 3 ); |
176 | 0 | append( sb, "", 0 ); |
177 | |
|
178 | 0 | append( sb, "tags", 2 ); |
179 | 0 | append( sb, "Used to specify the tag (or list of tags) to start log entries from.", 3 ); |
180 | 0 | append( sb, "", 0 ); |
181 | |
|
182 | 0 | append( sb, "type (Default: range)", 2 ); |
183 | 0 | append( sb, "Used to specify whether to build the log using range, tag or date.", 3 ); |
184 | 0 | append( sb, "", 0 ); |
185 | |
|
186 | 0 | append( sb, "username", 2 ); |
187 | 0 | append( sb, "The user name (used by svn and starteam protocol).", 3 ); |
188 | 0 | append( sb, "", 0 ); |
189 | |
} |
190 | |
} |
191 | |
|
192 | 0 | if ( goal == null || goal.length() <= 0 || "dev-activity".equals( goal ) ) |
193 | |
{ |
194 | 0 | append( sb, "changelog:dev-activity", 0 ); |
195 | 0 | append( sb, "Generate a developer activity report.", 1 ); |
196 | 0 | append( sb, "", 0 ); |
197 | 0 | if ( detail ) |
198 | |
{ |
199 | 0 | append( sb, "Available parameters:", 1 ); |
200 | 0 | append( sb, "", 0 ); |
201 | |
|
202 | 0 | append( sb, "basedir", 2 ); |
203 | 0 | append( sb, "Input dir. Directory where the files under SCM control are located.", 3 ); |
204 | 0 | append( sb, "", 0 ); |
205 | |
|
206 | 0 | append( sb, "commentFormat", 2 ); |
207 | 0 | append( sb, "Comment format string used for interrogating the revision control system. Currently only used by the ClearcaseChangeLogGenerator.", 3 ); |
208 | 0 | append( sb, "", 0 ); |
209 | |
|
210 | 0 | append( sb, "connectionType (Default: connection)", 2 ); |
211 | 0 | append( sb, "Allows the user to choose which scm connection to use when connecting to the scm. Can either be \'connection\' or \'developerConnection\'.", 3 ); |
212 | 0 | append( sb, "", 0 ); |
213 | |
|
214 | 0 | append( sb, "dateFormat (Default: yyyy-MM-dd HH:mm:ss)", 2 ); |
215 | 0 | append( sb, "Used to specify the date format of the log entries that are retrieved from your SCM system.", 3 ); |
216 | 0 | append( sb, "", 0 ); |
217 | |
|
218 | 0 | append( sb, "dates", 2 ); |
219 | 0 | append( sb, "Used to specify the absolute date (or list of dates) to start log entries from.", 3 ); |
220 | 0 | append( sb, "", 0 ); |
221 | |
|
222 | 0 | append( sb, "developers", 2 ); |
223 | 0 | append( sb, "List of developers to be shown on the report.", 3 ); |
224 | 0 | append( sb, "", 0 ); |
225 | |
|
226 | 0 | append( sb, "displayChangeSetDetailUrl", 2 ); |
227 | 0 | append( sb, "A template string that is used to create the changeset URL. If not defined no change set link will be created. There is one special token that you can use in your template:\n-\t%REV% - this is the changeset revision\n\nExample: http://fisheye.sourceforge.net/changelog/a-project/?cs=%REV%\n\nNote: If you don\'t supply the %REV% token in your template, the revision will simply be appended to your template URL.\n", 3 ); |
228 | 0 | append( sb, "", 0 ); |
229 | |
|
230 | 0 | append( sb, "displayFileDetailUrl (Default: ${project.scm.url})", 2 ); |
231 | 0 | append( sb, "A template string that is used to create the URL to the file details. There is a special token that you can use in your template:\n-\t%FILE% - this is the path to a file\n\nExample: http://checkstyle.cvs.sourceforge.net/checkstyle%FILE%?view=markup\n\nNote: If you don\'t supply the token in your template, the path of the file will simply be appended to your template URL.\n", 3 ); |
232 | 0 | append( sb, "", 0 ); |
233 | |
|
234 | 0 | append( sb, "displayFileRevDetailUrl", 2 ); |
235 | 0 | append( sb, "A template string that is used to create the revision aware URL to the file details in a similar fashion to the displayFileDetailUrl. When a report contains both file and file revision information, as in the Change Log report, this template string can be used to create a revision aware URL to the file details. If not defined this template string defaults to the same value as the displayFileDetailUrl and thus revision number aware links will not be used. There are two special tokens that you can use in your template:\n-\t%FILE% - this is the path to a file\n-\t%REV% - this is the revision of the file\n\nExample: http://fisheye.sourceforge.net/browse/a-project/%FILE%?r=%REV%\n\nNote: If you don\'t supply the %FILE% token in your template, the path of the file will simply be appended to your template URL.\n", 3 ); |
236 | 0 | append( sb, "", 0 ); |
237 | |
|
238 | 0 | append( sb, "headingDateFormat (Default: yyyy-MM-dd)", 2 ); |
239 | 0 | append( sb, "Used to specify the format to use for the dates in the headings of the report.", 3 ); |
240 | 0 | append( sb, "", 0 ); |
241 | |
|
242 | 0 | append( sb, "issueIDRegexPattern (Default: [a-zA-Z]{2,}-\\d+)", 2 ); |
243 | 0 | append( sb, "A pattern used to identify \'issue tracker\' IDs such as those used by JIRA, Bugzilla and alike in the SCM commit messages. Any matched patterns are replaced with issueLinkUrl URL. The default value is a JIRA-style issue identification pattern.", 3 ); |
244 | 0 | append( sb, "", 0 ); |
245 | |
|
246 | 0 | append( sb, "issueLinkUrl (Default: http://jira.codehaus.org/browse/%ISSUE%)", 2 ); |
247 | 0 | append( sb, "The issue tracker URL used when replacing any matched issueIDRegexPattern found in the SCM commit messages. The default is URL is the codehaus JIRA URL. If %ISSUE% is found in the URL it is replaced with the matched issue ID, otherwise the matched issue ID is appended to the URL.", 3 ); |
248 | 0 | append( sb, "", 0 ); |
249 | |
|
250 | 0 | append( sb, "outputEncoding (Default: ISO-8859-1)", 2 ); |
251 | 0 | append( sb, "Output encoding for the xml document", 3 ); |
252 | 0 | append( sb, "", 0 ); |
253 | |
|
254 | 0 | append( sb, "outputXML", 2 ); |
255 | 0 | append( sb, "Output file for xml document", 3 ); |
256 | 0 | append( sb, "", 0 ); |
257 | |
|
258 | 0 | append( sb, "outputXMLExpiration (Default: 60)", 2 ); |
259 | 0 | append( sb, "Allows the user to make changelog regenerate the changelog.xml file for the specified time in minutes.", 3 ); |
260 | 0 | append( sb, "", 0 ); |
261 | |
|
262 | 0 | append( sb, "passphrase", 2 ); |
263 | 0 | append( sb, "The passphrase (used by java svn).", 3 ); |
264 | 0 | append( sb, "", 0 ); |
265 | |
|
266 | 0 | append( sb, "password", 2 ); |
267 | 0 | append( sb, "The user password (used by svn and starteam protocol).", 3 ); |
268 | 0 | append( sb, "", 0 ); |
269 | |
|
270 | 0 | append( sb, "privateKey", 2 ); |
271 | 0 | append( sb, "The private key (used by java svn).", 3 ); |
272 | 0 | append( sb, "", 0 ); |
273 | |
|
274 | 0 | append( sb, "range (Default: -1)", 2 ); |
275 | 0 | append( sb, "Used to specify the number of days of log entries to retrieve.", 3 ); |
276 | 0 | append( sb, "", 0 ); |
277 | |
|
278 | 0 | append( sb, "scmUrl", 2 ); |
279 | 0 | append( sb, "The URL to view the scm. Basis for external links from the generated report.", 3 ); |
280 | 0 | append( sb, "", 0 ); |
281 | |
|
282 | 0 | append( sb, "systemProperties", 2 ); |
283 | 0 | append( sb, "The system properties to use (needed by the perforce scm provider).", 3 ); |
284 | 0 | append( sb, "", 0 ); |
285 | |
|
286 | 0 | append( sb, "tagBase", 2 ); |
287 | 0 | append( sb, "The url of tags base directory (used by svn protocol).", 3 ); |
288 | 0 | append( sb, "", 0 ); |
289 | |
|
290 | 0 | append( sb, "tags", 2 ); |
291 | 0 | append( sb, "Used to specify the tag (or list of tags) to start log entries from.", 3 ); |
292 | 0 | append( sb, "", 0 ); |
293 | |
|
294 | 0 | append( sb, "type (Default: range)", 2 ); |
295 | 0 | append( sb, "Used to specify whether to build the log using range, tag or date.", 3 ); |
296 | 0 | append( sb, "", 0 ); |
297 | |
|
298 | 0 | append( sb, "username", 2 ); |
299 | 0 | append( sb, "The user name (used by svn and starteam protocol).", 3 ); |
300 | 0 | append( sb, "", 0 ); |
301 | |
} |
302 | |
} |
303 | |
|
304 | 0 | if ( goal == null || goal.length() <= 0 || "file-activity".equals( goal ) ) |
305 | |
{ |
306 | 0 | append( sb, "changelog:file-activity", 0 ); |
307 | 0 | append( sb, "Generate a file activity report.", 1 ); |
308 | 0 | append( sb, "", 0 ); |
309 | 0 | if ( detail ) |
310 | |
{ |
311 | 0 | append( sb, "Available parameters:", 1 ); |
312 | 0 | append( sb, "", 0 ); |
313 | |
|
314 | 0 | append( sb, "basedir", 2 ); |
315 | 0 | append( sb, "Input dir. Directory where the files under SCM control are located.", 3 ); |
316 | 0 | append( sb, "", 0 ); |
317 | |
|
318 | 0 | append( sb, "commentFormat", 2 ); |
319 | 0 | append( sb, "Comment format string used for interrogating the revision control system. Currently only used by the ClearcaseChangeLogGenerator.", 3 ); |
320 | 0 | append( sb, "", 0 ); |
321 | |
|
322 | 0 | append( sb, "connectionType (Default: connection)", 2 ); |
323 | 0 | append( sb, "Allows the user to choose which scm connection to use when connecting to the scm. Can either be \'connection\' or \'developerConnection\'.", 3 ); |
324 | 0 | append( sb, "", 0 ); |
325 | |
|
326 | 0 | append( sb, "dateFormat (Default: yyyy-MM-dd HH:mm:ss)", 2 ); |
327 | 0 | append( sb, "Used to specify the date format of the log entries that are retrieved from your SCM system.", 3 ); |
328 | 0 | append( sb, "", 0 ); |
329 | |
|
330 | 0 | append( sb, "dates", 2 ); |
331 | 0 | append( sb, "Used to specify the absolute date (or list of dates) to start log entries from.", 3 ); |
332 | 0 | append( sb, "", 0 ); |
333 | |
|
334 | 0 | append( sb, "developers", 2 ); |
335 | 0 | append( sb, "List of developers to be shown on the report.", 3 ); |
336 | 0 | append( sb, "", 0 ); |
337 | |
|
338 | 0 | append( sb, "displayChangeSetDetailUrl", 2 ); |
339 | 0 | append( sb, "A template string that is used to create the changeset URL. If not defined no change set link will be created. There is one special token that you can use in your template:\n-\t%REV% - this is the changeset revision\n\nExample: http://fisheye.sourceforge.net/changelog/a-project/?cs=%REV%\n\nNote: If you don\'t supply the %REV% token in your template, the revision will simply be appended to your template URL.\n", 3 ); |
340 | 0 | append( sb, "", 0 ); |
341 | |
|
342 | 0 | append( sb, "displayFileDetailUrl (Default: ${project.scm.url})", 2 ); |
343 | 0 | append( sb, "A template string that is used to create the URL to the file details. There is a special token that you can use in your template:\n-\t%FILE% - this is the path to a file\n\nExample: http://checkstyle.cvs.sourceforge.net/checkstyle%FILE%?view=markup\n\nNote: If you don\'t supply the token in your template, the path of the file will simply be appended to your template URL.\n", 3 ); |
344 | 0 | append( sb, "", 0 ); |
345 | |
|
346 | 0 | append( sb, "displayFileRevDetailUrl", 2 ); |
347 | 0 | append( sb, "A template string that is used to create the revision aware URL to the file details in a similar fashion to the displayFileDetailUrl. When a report contains both file and file revision information, as in the Change Log report, this template string can be used to create a revision aware URL to the file details. If not defined this template string defaults to the same value as the displayFileDetailUrl and thus revision number aware links will not be used. There are two special tokens that you can use in your template:\n-\t%FILE% - this is the path to a file\n-\t%REV% - this is the revision of the file\n\nExample: http://fisheye.sourceforge.net/browse/a-project/%FILE%?r=%REV%\n\nNote: If you don\'t supply the %FILE% token in your template, the path of the file will simply be appended to your template URL.\n", 3 ); |
348 | 0 | append( sb, "", 0 ); |
349 | |
|
350 | 0 | append( sb, "headingDateFormat (Default: yyyy-MM-dd)", 2 ); |
351 | 0 | append( sb, "Used to specify the format to use for the dates in the headings of the report.", 3 ); |
352 | 0 | append( sb, "", 0 ); |
353 | |
|
354 | 0 | append( sb, "issueIDRegexPattern (Default: [a-zA-Z]{2,}-\\d+)", 2 ); |
355 | 0 | append( sb, "A pattern used to identify \'issue tracker\' IDs such as those used by JIRA, Bugzilla and alike in the SCM commit messages. Any matched patterns are replaced with issueLinkUrl URL. The default value is a JIRA-style issue identification pattern.", 3 ); |
356 | 0 | append( sb, "", 0 ); |
357 | |
|
358 | 0 | append( sb, "issueLinkUrl (Default: http://jira.codehaus.org/browse/%ISSUE%)", 2 ); |
359 | 0 | append( sb, "The issue tracker URL used when replacing any matched issueIDRegexPattern found in the SCM commit messages. The default is URL is the codehaus JIRA URL. If %ISSUE% is found in the URL it is replaced with the matched issue ID, otherwise the matched issue ID is appended to the URL.", 3 ); |
360 | 0 | append( sb, "", 0 ); |
361 | |
|
362 | 0 | append( sb, "outputEncoding (Default: ISO-8859-1)", 2 ); |
363 | 0 | append( sb, "Output encoding for the xml document", 3 ); |
364 | 0 | append( sb, "", 0 ); |
365 | |
|
366 | 0 | append( sb, "outputXML", 2 ); |
367 | 0 | append( sb, "Output file for xml document", 3 ); |
368 | 0 | append( sb, "", 0 ); |
369 | |
|
370 | 0 | append( sb, "outputXMLExpiration (Default: 60)", 2 ); |
371 | 0 | append( sb, "Allows the user to make changelog regenerate the changelog.xml file for the specified time in minutes.", 3 ); |
372 | 0 | append( sb, "", 0 ); |
373 | |
|
374 | 0 | append( sb, "passphrase", 2 ); |
375 | 0 | append( sb, "The passphrase (used by java svn).", 3 ); |
376 | 0 | append( sb, "", 0 ); |
377 | |
|
378 | 0 | append( sb, "password", 2 ); |
379 | 0 | append( sb, "The user password (used by svn and starteam protocol).", 3 ); |
380 | 0 | append( sb, "", 0 ); |
381 | |
|
382 | 0 | append( sb, "privateKey", 2 ); |
383 | 0 | append( sb, "The private key (used by java svn).", 3 ); |
384 | 0 | append( sb, "", 0 ); |
385 | |
|
386 | 0 | append( sb, "range (Default: -1)", 2 ); |
387 | 0 | append( sb, "Used to specify the number of days of log entries to retrieve.", 3 ); |
388 | 0 | append( sb, "", 0 ); |
389 | |
|
390 | 0 | append( sb, "scmUrl", 2 ); |
391 | 0 | append( sb, "The URL to view the scm. Basis for external links from the generated report.", 3 ); |
392 | 0 | append( sb, "", 0 ); |
393 | |
|
394 | 0 | append( sb, "systemProperties", 2 ); |
395 | 0 | append( sb, "The system properties to use (needed by the perforce scm provider).", 3 ); |
396 | 0 | append( sb, "", 0 ); |
397 | |
|
398 | 0 | append( sb, "tagBase", 2 ); |
399 | 0 | append( sb, "The url of tags base directory (used by svn protocol).", 3 ); |
400 | 0 | append( sb, "", 0 ); |
401 | |
|
402 | 0 | append( sb, "tags", 2 ); |
403 | 0 | append( sb, "Used to specify the tag (or list of tags) to start log entries from.", 3 ); |
404 | 0 | append( sb, "", 0 ); |
405 | |
|
406 | 0 | append( sb, "type (Default: range)", 2 ); |
407 | 0 | append( sb, "Used to specify whether to build the log using range, tag or date.", 3 ); |
408 | 0 | append( sb, "", 0 ); |
409 | |
|
410 | 0 | append( sb, "username", 2 ); |
411 | 0 | append( sb, "The user name (used by svn and starteam protocol).", 3 ); |
412 | 0 | append( sb, "", 0 ); |
413 | |
} |
414 | |
} |
415 | |
|
416 | 0 | if ( goal == null || goal.length() <= 0 || "help".equals( goal ) ) |
417 | |
{ |
418 | 0 | append( sb, "changelog:help", 0 ); |
419 | 0 | append( sb, "Display help information on maven-changelog-plugin.\nCall\n\u00a0\u00a0mvn\u00a0changelog:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 ); |
420 | 0 | append( sb, "", 0 ); |
421 | 0 | if ( detail ) |
422 | |
{ |
423 | 0 | append( sb, "Available parameters:", 1 ); |
424 | 0 | append( sb, "", 0 ); |
425 | |
|
426 | 0 | append( sb, "detail (Default: false)", 2 ); |
427 | 0 | append( sb, "If true, display all settable properties for each goal.", 3 ); |
428 | 0 | append( sb, "", 0 ); |
429 | |
|
430 | 0 | append( sb, "goal", 2 ); |
431 | 0 | append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 ); |
432 | 0 | append( sb, "", 0 ); |
433 | |
|
434 | 0 | append( sb, "indentSize (Default: 2)", 2 ); |
435 | 0 | append( sb, "The number of spaces per indentation level, should be positive.", 3 ); |
436 | 0 | append( sb, "", 0 ); |
437 | |
|
438 | 0 | append( sb, "lineLength (Default: 80)", 2 ); |
439 | 0 | append( sb, "The maximum length of a display line, should be positive.", 3 ); |
440 | 0 | append( sb, "", 0 ); |
441 | |
} |
442 | |
} |
443 | |
|
444 | 0 | if ( getLog().isInfoEnabled() ) |
445 | |
{ |
446 | 0 | getLog().info( sb.toString() ); |
447 | |
} |
448 | 0 | } |
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
|
454 | |
|
455 | |
|
456 | |
|
457 | |
|
458 | |
|
459 | |
private static String repeat( String str, int repeat ) |
460 | |
{ |
461 | 0 | StringBuffer buffer = new StringBuffer( repeat * str.length() ); |
462 | |
|
463 | 0 | for ( int i = 0; i < repeat; i++ ) |
464 | |
{ |
465 | 0 | buffer.append( str ); |
466 | |
} |
467 | |
|
468 | 0 | return buffer.toString(); |
469 | |
} |
470 | |
|
471 | |
|
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
|
477 | |
|
478 | |
|
479 | |
private void append( StringBuffer sb, String description, int indent ) |
480 | |
{ |
481 | 0 | for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); ) |
482 | |
{ |
483 | 0 | sb.append( it.next().toString() ).append( '\n' ); |
484 | |
} |
485 | 0 | } |
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | |
|
495 | |
|
496 | |
|
497 | |
private static List toLines( String text, int indent, int indentSize, int lineLength ) |
498 | |
{ |
499 | 0 | List lines = new ArrayList(); |
500 | |
|
501 | 0 | String ind = repeat( "\t", indent ); |
502 | 0 | String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); |
503 | 0 | for ( int i = 0; i < plainLines.length; i++ ) |
504 | |
{ |
505 | 0 | toLines( lines, ind + plainLines[i], indentSize, lineLength ); |
506 | |
} |
507 | |
|
508 | 0 | return lines; |
509 | |
} |
510 | |
|
511 | |
|
512 | |
|
513 | |
|
514 | |
|
515 | |
|
516 | |
|
517 | |
|
518 | |
|
519 | |
private static void toLines( List lines, String line, int indentSize, int lineLength ) |
520 | |
{ |
521 | 0 | int lineIndent = getIndentLevel( line ); |
522 | 0 | StringBuffer buf = new StringBuffer( 256 ); |
523 | 0 | String[] tokens = line.split( " +" ); |
524 | 0 | for ( int i = 0; i < tokens.length; i++ ) |
525 | |
{ |
526 | 0 | String token = tokens[i]; |
527 | 0 | if ( i > 0 ) |
528 | |
{ |
529 | 0 | if ( buf.length() + token.length() >= lineLength ) |
530 | |
{ |
531 | 0 | lines.add( buf.toString() ); |
532 | 0 | buf.setLength( 0 ); |
533 | 0 | buf.append( repeat( " ", lineIndent * indentSize ) ); |
534 | |
} |
535 | |
else |
536 | |
{ |
537 | 0 | buf.append( ' ' ); |
538 | |
} |
539 | |
} |
540 | 0 | for ( int j = 0; j < token.length(); j++ ) |
541 | |
{ |
542 | 0 | char c = token.charAt( j ); |
543 | 0 | if ( c == '\t' ) |
544 | |
{ |
545 | 0 | buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); |
546 | |
} |
547 | 0 | else if ( c == '\u00A0' ) |
548 | |
{ |
549 | 0 | buf.append( ' ' ); |
550 | |
} |
551 | |
else |
552 | |
{ |
553 | 0 | buf.append( c ); |
554 | |
} |
555 | |
} |
556 | |
} |
557 | 0 | lines.add( buf.toString() ); |
558 | 0 | } |
559 | |
|
560 | |
|
561 | |
|
562 | |
|
563 | |
|
564 | |
|
565 | |
|
566 | |
private static int getIndentLevel( String line ) |
567 | |
{ |
568 | 0 | int level = 0; |
569 | 0 | for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) |
570 | |
{ |
571 | 0 | level++; |
572 | |
} |
573 | 0 | for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) |
574 | |
{ |
575 | 0 | if ( line.charAt( i ) == '\t' ) |
576 | |
{ |
577 | 0 | level++; |
578 | 0 | break; |
579 | |
} |
580 | |
} |
581 | 0 | return level; |
582 | |
} |
583 | |
} |