Skip to content

Instantly share code, notes, and snippets.

@aneveux
Created November 8, 2013 17:25
Show Gist options
  • Save aneveux/7374506 to your computer and use it in GitHub Desktop.
Save aneveux/7374506 to your computer and use it in GitHub Desktop.
package com.sample.demo.commands;
import com.sample.demo.Messages;
import com.worldline.clic.commands.AbstractCommand;
import com.worldline.clic.commands.CommandContext;
/**
* Just an example of a command...
*
* @author aneveux
* @version 1.0
* @since 1.0
*/
public class HelloCommand extends AbstractCommand {
/**
* Allows to configure the parser and specify all the options which are
* available for the command. It allows to perform validation of all the
* command line.
*/
@Override
public void configureParser() {
parser.accepts("name")
.withRequiredArg()
.ofType(String.class)
.required();
}
/**
* Allows to deal with the command's execution...
*/
@Override
public void execute(final CommandContext context) {
context.write(Messages.HELLO.value(options.valueOf("name")));
context.addOutput("-project-name");
context.addOutput("project-"+options.valueOf("name"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment