keith-turner commented on a change in pull request #409: ACCUMULO-4791 fix
setshelliter usage
URL: https://github.com/apache/accumulo/pull/409#discussion_r178290547
##########
File path:
shell/src/main/java/org/apache/accumulo/shell/commands/SetShellIterCommand.java
##########
@@ -85,32 +86,43 @@ public String description() {
@Override
public Options getOptions() {
- // Remove the options that specify which type of iterator this is, since
- // they are all scan iterators with this command.
- final HashSet<OptionGroup> groups = new HashSet<>();
- final Options parentOptions = super.getOptions();
- final Options modifiedOptions = new Options();
- for (Iterator<?> it = parentOptions.getOptions().iterator();
it.hasNext();) {
- Option o = (Option) it.next();
- if (!IteratorScope.majc.name().equals(o.getOpt()) &&
!IteratorScope.minc.name().equals(o.getOpt()) &&
!IteratorScope.scan.name().equals(o.getOpt())
- && !"table".equals(o.getLongOpt())) {
- modifiedOptions.addOption(o);
- OptionGroup group = parentOptions.getOptionGroup(o);
- if (group != null)
- groups.add(group);
- }
- }
- for (OptionGroup group : groups) {
- modifiedOptions.addOptionGroup(group);
- }
+
+ final Options o = new Options();
profileOpt = new Option("pn", "profile", true, "iterator profile name");
profileOpt.setRequired(true);
profileOpt.setArgName("profile");
- modifiedOptions.addOption(profileOpt);
-
- return modifiedOptions;
+ priorityOpt = new Option("p", "priority", true, "the order in which the
iterator is applied");
+ priorityOpt.setArgName("pri");
+ priorityOpt.setRequired(true);
+
Review comment:
Could refactor this to have a protected method in the parent called
`getBaseOptions()`. This method would create the subset of options that
setiter and setshelliter both use. The the getOptions() methods of both
classes could call it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services