Added comment and test
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
@@ -43,10 +43,21 @@ import net.bigeon.gclc.exception.CommandRunException;
|
||||
import net.bigeon.gclc.manager.ConsoleInput;
|
||||
import net.bigeon.gclc.manager.ConsoleOutput;
|
||||
|
||||
/** @author Emmanuel Bigeon */
|
||||
/** A command printing test to the console.
|
||||
* <p>
|
||||
* This command mimics the effect of the echo command in linux system. The
|
||||
* difference is this command accepts java like formatting.
|
||||
*
|
||||
* <pre>
|
||||
* echo.execute(out, in, "My Formatted {0}, with {1}", "message", "short arguments");
|
||||
* </pre>
|
||||
*
|
||||
* @author Emmanuel Bigeon */
|
||||
public class EchoCommand extends Command {
|
||||
|
||||
/** @param name the command name */
|
||||
/** Create the command.
|
||||
*
|
||||
* @param name the command name */
|
||||
public EchoCommand(final String name) {
|
||||
super(name);
|
||||
}
|
||||
@@ -56,8 +67,8 @@ public class EchoCommand extends Command {
|
||||
* fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.manager.ConsoleOutput,
|
||||
* fr.bigeon.gclc.manager.ConsoleInput, java.lang.String[]) */
|
||||
@Override
|
||||
public void execute(final ConsoleOutput out, final ConsoleInput in, final String... args)
|
||||
throws CommandRunException {
|
||||
public void execute(final ConsoleOutput out, final ConsoleInput in,
|
||||
final String... args) throws CommandRunException {
|
||||
try {
|
||||
if (args.length == 1) {
|
||||
out.print(args[0]);
|
||||
|
||||
Reference in New Issue
Block a user