Created
November 6, 2013 09:49
-
-
Save aneveux/7333539 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.acme.sample.commands; | |
import com.acme.sample.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"))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment