Enable command name autocomplete for nomulus tool

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137299749
This commit is contained in:
ctingue 2016-10-26 11:39:47 -07:00 committed by Ben McIlwain
parent 198558901d
commit 1b7cee61a5

View file

@ -42,6 +42,11 @@ final class RegistryCli {
description = "Sets the default environment to run the command.")
private RegistryToolEnvironment environment = RegistryToolEnvironment.PRODUCTION;
@Parameter(
names = {"-c", "--commands"},
description = "Returns all command names.")
private boolean showAllCommands;
// Do not make this final - compile-time constant inlining may interfere with JCommander.
@ParametersDelegate
private AppEngineConnection connection = new AppEngineConnection();
@ -94,6 +99,13 @@ final class RegistryCli {
throw e;
}
if (showAllCommands) {
for (Map.Entry<String, ? extends Class<? extends Command>> entry : commands.entrySet()) {
System.out.println(entry.getKey());
}
return;
}
checkState(RegistryToolEnvironment.get() == environment,
"RegistryToolEnvironment argument pre-processing kludge failed.");