Remove unused ShellCommand.JCommanderCompletor.getParamDoc()

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201038811
This commit is contained in:
mcilwain 2018-06-18 12:23:08 -07:00 committed by Ben McIlwain
parent 03f8090886
commit 7a4a4ba3d5

View file

@ -269,6 +269,9 @@ public class ShellCommand implements Command {
@VisibleForTesting
static class JCommanderCompletor implements Completor {
private static final ParamDoc DEFAULT_PARAM_DOC =
ParamDoc.create("[No documentation available]", ImmutableList.of());
/**
* Documentation for all the known command + argument combinations.
*
@ -504,26 +507,6 @@ public class ShellCommand implements Command {
isFlagParameter ? "Flag documentation" : "Main parameter", paramDoc.documentation());
return ImmutableList.of("", documentation);
}
private static final ParamDoc DEFAULT_PARAM_DOC =
ParamDoc.create("[No documentation available]", ImmutableList.of());
private @Nullable ParamDoc getParamDoc(String command, @Nullable String previousArgument) {
// First, check if we want the documentation for a specific flag, or for the "main"
// parameters.
//
// We want documentation for a flag if the previous argument was a flag, but the value of the
// flag wasn't set. So if the previous argument is "--flag" then we want documentation of that
// flag, but if it's "--flag=value" then that flag is set and we want documentation of the
// main parameters.
boolean isFlagParameter =
previousArgument != null
&& previousArgument.startsWith("-")
&& previousArgument.indexOf('=') == -1;
return Optional.ofNullable(
commandFlagDocs.get(command, isFlagParameter ? previousArgument : ""))
.orElse(DEFAULT_PARAM_DOC);
}
}
/**