com.cloudbees.sdk.cli
Class ACommand

java.lang.Object
  extended by com.cloudbees.sdk.cli.ACommand
Direct Known Subclasses:
AbstractCommand

public abstract class ACommand
extends Object

A CLI command.

This is the contract of CLI commands. All the abstract subtypes are merely convenient partial implementations.

A command in CloudBees SDK is usually invoked as a sub-command of the bees command. It takes arbitrary numbers of arguments, whose meanings are entirely up to command implmentations. A command interacts with stdin/stdout/stderr.

Commands are instantiated with Guice, so they receive dependency injections.

Author:
Kohsuke Kawaguchi

Constructor Summary
ACommand()
           
 
Method Summary
abstract  void printHelp(List<String> args)
          Print out the detailed help of this command.
abstract  int run(List<String> args)
          Executes this command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ACommand

public ACommand()
Method Detail

run

public abstract int run(List<String> args)
                 throws Exception
Executes this command.

Parameters:
args - Never empty, never null. The first argument is the command name itself, followed by arguments
Returns:
The exit code of the command. 99 is apparently used for something special that I haven't figured out.
Throws:
Exception

printHelp

public abstract void printHelp(List<String> args)
Print out the detailed help of this command.

Parameters:
args - For backward compatibility, this method receives the full argument list (where the first token is the command name for which the help is requested.)


Copyright © 2011-2014. All Rights Reserved.