hudson.cli
Class GroovyshCommand

java.lang.Object
  extended by hudson.cli.CLICommand
      extended by hudson.cli.GroovyshCommand
All Implemented Interfaces:
ExtensionPoint, Cloneable

@Extension
public class GroovyshCommand
extends CLICommand

Executes Groovy shell.

Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from class hudson.cli.CLICommand
channel, locale, stderr, stdin, stdout, TRANSPORT_AUTHENTICATION
 
Constructor Summary
GroovyshCommand()
           
 
Method Summary
protected  org.codehaus.groovy.tools.shell.Groovysh createShell(InputStream stdin, PrintStream stdout, PrintStream stderr)
           
 String getShortDescription()
          Gets the quick summary of what this command does.
 int main(List<String> args, Locale locale, InputStream stdin, PrintStream stdout, PrintStream stderr)
          Entry point to the CLI command.
protected  int run()
          Executes the command, and return the exit code.
 
Methods inherited from class hudson.cli.CLICommand
all, checkChannel, clone, createClone, getClientCharset, getClientEnvironmentVariable, getClientSystemProperty, getCurrent, getName, getTransportAuthentication, loadStoredAuthentication, printUsage, printUsageSummary, registerOptionHandlers, setTransportAuth, shouldPerformAuthentication
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyshCommand

public GroovyshCommand()
Method Detail

getShortDescription

public String getShortDescription()
Description copied from class: CLICommand
Gets the quick summary of what this command does. Used by the help command to generate the list of commands.

Specified by:
getShortDescription in class CLICommand

main

public int main(List<String> args,
                Locale locale,
                InputStream stdin,
                PrintStream stdout,
                PrintStream stderr)
Description copied from class: CLICommand
Entry point to the CLI command.

The default implementation uses args4j to parse command line arguments and call CLICommand.run(), but if that processing is undesirable, subtypes can directly override this method and leave CLICommand.run() to an empty method.

Overrides:
main in class CLICommand
Parameters:
args - Arguments to the sub command. For example, if the CLI is invoked like "java -jar cli.jar foo bar zot", then "foo" is the sub-command and the argument list is ["bar","zot"].
locale - Locale of the client (which can be different from that of the server.) Good behaving command implementation would use this locale for formatting messages.
stdin - Connected to the stdin of the CLI client.
stdout - Connected to the stdout of the CLI client.
stderr - Connected to the stderr of the CLI client.
Returns:
Exit code from the command.

createShell

protected org.codehaus.groovy.tools.shell.Groovysh createShell(InputStream stdin,
                                                               PrintStream stdout,
                                                               PrintStream stderr)

run

protected int run()
Description copied from class: CLICommand
Executes the command, and return the exit code.

This is an internal contract between CLICommand and its subtype. To execute CLI method from outside, use CLICommand.main(List, Locale, InputStream, PrintStream, PrintStream)

Specified by:
run in class CLICommand
Returns:
0 to indicate a success, otherwise an error code.


Copyright © 2004-2013. All Rights Reserved.