mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Remove unused ShellCommand.JCommanderCompletor.getParamDoc()
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=201038811
This commit is contained in:
parent
03f8090886
commit
7a4a4ba3d5
1 changed files with 3 additions and 20 deletions
|
@ -269,6 +269,9 @@ public class ShellCommand implements Command {
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static class JCommanderCompletor implements Completor {
|
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.
|
* Documentation for all the known command + argument combinations.
|
||||||
*
|
*
|
||||||
|
@ -504,26 +507,6 @@ public class ShellCommand implements Command {
|
||||||
isFlagParameter ? "Flag documentation" : "Main parameter", paramDoc.documentation());
|
isFlagParameter ? "Flag documentation" : "Main parameter", paramDoc.documentation());
|
||||||
return ImmutableList.of("", 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue