ctubbsii commented on code in PR #3680:
URL: https://github.com/apache/accumulo/pull/3680#discussion_r1289616691
##########
shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java:
##########
@@ -436,4 +449,18 @@ public Options getOptions() {
public int numArgs() {
return 0;
}
+
+ /**
+ * Determine is force is set as an option or user enters (y | yes) on the
shell prompt.
+ *
+ * @return true if force is set as opt or y | yes entered at command line.
+ */
+ private boolean forceSet(final Shell shellState, final CommandLine cl, final
String prompt) {
+ if (cl.hasOption(forceOpt)) {
+ return true;
+ }
+ shellState.getWriter().flush();
+ String line = shellState.getReader().readLine(prompt + " (yes|no)? ");
+ return line != null && (line.equalsIgnoreCase("y") ||
line.equalsIgnoreCase("yes"));
Review Comment:
This prompt feels very custom. I suspect there are other places in the shell
where we have a similar prompt. It'd be good to maintain consistency across the
shell for yes/no prompts. I suggest putting this in the Shell class, or moving
any existing similar method into the Shell class, and calling it there, as in:
```java
if (cl.hasOption(forceOpt) || shellState.yesNo(prompt)) {
// ...
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]