Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help flag for admin command does not work for subcommands #4755

Open
ddanielr opened this issue Jul 24, 2024 · 1 comment · May be fixed by #5220
Open

Help flag for admin command does not work for subcommands #4755

ddanielr opened this issue Jul 24, 2024 · 1 comment · May be fixed by #5220
Assignees
Labels
bug This issue has been verified to be a bug.
Milestone

Comments

@ddanielr
Copy link
Contributor

Describe the bug
When using the ./accumulo admin command, help flags -h, --help, -help, -? will only work at the top level, and will throw an error if set on any subcommand.

./accumulo admin volumes -h
Thread 'admin' died.
com.beust.jcommander.ParameterException: Was passed main parameter '-h' but no main parameter was defined in your arg class
	at com.beust.jcommander.JCommander.initMainParameterValue(JCommander.java:961)
	at com.beust.jcommander.JCommander.parseValues(JCommander.java:762)
	at com.beust.jcommander.JCommander.parse(JCommander.java:363)
	at com.beust.jcommander.JCommander.parseValues(JCommander.java:803)
	at com.beust.jcommander.JCommander.parse(JCommander.java:363)
	at com.beust.jcommander.JCommander.parse(JCommander.java:342)
	at org.apache.accumulo.server.util.Admin.execute(Admin.java:342)
	at org.apache.accumulo.start.Main.lambda$execKeyword$0(Main.java:81)
	at java.base/java.lang.Thread.run(Thread.java:842)

Due to the amount of subcommands, the top-level usage statement is large and typically scrolls off a terminal window.

Versions (OS, Maven, Java, and others, as appropriate):

  • Affected version(s) of this project: [e.g. 1.10.0] 2.1.x

To Reproduce
Steps to reproduce the behavior (or a link to an example repository that reproduces the problem):

  1. Run the accumulo admin command with any subcommand and add any of the help flags ./accumulo admin dumpConfig --help
  2. See a Parameter Exception stack trace

Expected behavior
The help flag should work with any subcommand used in the admin command

@ddanielr ddanielr added the bug This issue has been verified to be a bug. label Jul 24, 2024
@ddanielr ddanielr added this to the 2.1.3 milestone Jul 24, 2024
@ddanielr ddanielr assigned ddanielr and unassigned ddanielr Jul 24, 2024
@jmark99
Copy link
Contributor

jmark99 commented Jul 25, 2024

@ddanielr looking at the accumulo admin command usage states:

Usage: accumulo admin [options] [command] [command options]                                                                                       
  Options:                                                                                                                                        
    -auths, --auths                                                      
      the authorizations to use when reading or writing                                                                                           
      Default: <empty string>                                                                                                                     
    -c, --config-file                                                                                                                             
      Read the given client config file. If omitted, the classpath will be                                                                        
      searched for file named accumulo-client.properties                 
    -f, --force                                                          
      force the given server to stop by removing its lock                                                                                         
      Default: false                                                                                                                              
    -h, -?, --help, -help    
	......

The usage indicates that the help flags should appear between the admin and command values. None of the sub- commands themselves have any help flags listed. It appears the initial code only provided a help command for the overall admin command.

I went through each sub-command and If you execute each sub-command using that format no errors are thrown, but rather the entire accumulo admin help message is displayed.

The one exception is the randomizeVolumes command. This command will throw an exception if the -t <table> info is not provided.

I agree that it would nice if help info would be provided if a help flag was used anywhere on the command line, but I'm not sure if this is a bug or just a design choice that was made. I'm not sure how to best let the user know that the help flags should be earlier on the command line. Perhaps it should be considered an enhancement/improvement issue instead. What are your thoughts?

@ctubbsii ctubbsii modified the milestones: 2.1.3, 2.1.4 Jul 29, 2024
@ddanielr ddanielr self-assigned this Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue has been verified to be a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants