Skip to content
Permalink
Browse files
adding to CliConfiguration the ability to decorate the command
  • Loading branch information
Romain Manni-Bucau committed Nov 30, 2015
1 parent aa0914c commit 99972657e9547610de727041c9e4e6870e6e5a66
Showing 2 changed files with 7 additions and 1 deletion.
@@ -97,6 +97,11 @@ public Iterator<Class<? extends UserCommand>> userCommands() {
}
return classes.iterator();
}

@Override
public Runnable decorate(final Runnable task) {
return task;
}
};

final Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder(cliConfiguration.name())
@@ -120,7 +125,7 @@ public Iterator<Class<? extends UserCommand>> userCommands() {
final Cli<Runnable> parser = builder.build();

try {
parser.parse(args).run();
cliConfiguration.decorate(parser.parse(args)).run();
} catch (final ParseException e) {
parser.parse("help").run();
} catch (final RuntimeException e) {
@@ -23,4 +23,5 @@ public interface CliConfiguration {
String description();
boolean addDefaultCommands();
Iterator<Class<? extends UserCommand>> userCommands();
Runnable decorate(Runnable task);
}

0 comments on commit 9997265

Please sign in to comment.