Skip to content

Commit

Permalink
[FIXED JENKINS-9789] display the list of available CLI Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaeli authored and kohsuke committed May 28, 2011
1 parent 8af3905 commit 84a78d5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -59,6 +59,9 @@
Output correct version from java -jar jenkins.war --version (broken since 1.410)
<li class=bug>
Correct usage text from java -jar jenkins.war --help
<li class=rfe>
CLI command page now lists all the available commands
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-9789">issue 9789</a>)
</ul>
</div><!--=TRUNK-END=-->

Expand Down
12 changes: 12 additions & 0 deletions core/src/main/java/hudson/Functions.java
Expand Up @@ -24,6 +24,7 @@
*/
package hudson;

import hudson.cli.CLICommand;
import hudson.console.ConsoleAnnotationDescriptor;
import hudson.console.ConsoleAnnotatorFactory;
import hudson.model.AbstractProject;
Expand Down Expand Up @@ -1377,4 +1378,15 @@ public static List<String> getRequestHeaders(String name) {
public static Object rawHtml(Object o) {
return o==null ? null : new RawHtmlArgument(o);
}

public static ArrayList<CLICommand> getCLICommands() {
ArrayList<CLICommand> all = new ArrayList<CLICommand>(CLICommand.all());
Collections.sort(all, new Comparator<CLICommand>() {
public int compare(CLICommand cliCommand, CLICommand cliCommand1) {
return cliCommand.getName().compareTo(cliCommand1.getName());
}
});
return all;
}

}
6 changes: 6 additions & 0 deletions core/src/main/resources/hudson/model/Hudson/_cli.jelly
Expand Up @@ -37,6 +37,12 @@ THE SOFTWARE.
<pre style="color: white; background-color:black; padding:1em; font-weight: bold">java -jar <a
style="color: white"
href="jnlpJars/jenkins-cli.jar">jenkins-cli.jar</a> -s ${h.inferHudsonURL(request)} help</pre>
<h2>${%Available Commands}</h2>
<ul>
<j:forEach items="${h.getCLICommands()}" var="command">
<li><b>${command.getName()}</b>: ${command.getShortDescription()}</li>
</j:forEach>
</ul>
</l:main-panel>
</l:layout>
</j:jelly>
@@ -1,4 +1,4 @@
Jenkins\ CLI=Jenkins CLI
blurb=You can access various features in Jenkins through a command-line tool. See \
<a href="http://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI">the Wiki</a> for more details of this feature.\
To get started, download <a href="{0}/jnlpJars/jenkins-cli.jar">jenkins-cli.jar</a>, and run it as follows:

0 comments on commit 84a78d5

Please sign in to comment.