You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/04/20 15:21:05 UTC

[GitHub] [bookkeeper] hangc0276 opened a new pull request, #3227: Fix bookie shell help command exception

hangc0276 opened a new pull request, #3227:
URL: https://github.com/apache/bookkeeper/pull/3227

   ### Motivation
   When run `bin/bookkeeper shell ledgermetadata -h` command, it throw the following exception.
   ```
   23:02:41,236 ERROR Error parsing command line arguments :
   org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -h
   	at org.apache.commons.cli.Parser.processOption(Parser.java:363) ~[commons-cli-commons-cli-1.2.jar:1.2]
   	at org.apache.commons.cli.Parser.parse(Parser.java:199) ~[commons-cli-commons-cli-1.2.jar:1.2]
   	at org.apache.commons.cli.Parser.parse(Parser.java:85) ~[commons-cli-commons-cli-1.2.jar:1.2]
   	at org.apache.bookkeeper.bookie.BookieShell$MyCommand.runCmd(BookieShell.java:240) ~[org.apache.bookkeeper-bookkeeper-server-4.16.0-SNAPSHOT.jar:4.16.0-SNAPSHOT]
   	at org.apache.bookkeeper.bookie.BookieShell.run(BookieShell.java:2372) ~[org.apache.bookkeeper-bookkeeper-server-4.16.0-SNAPSHOT.jar:4.16.0-SNAPSHOT]
   	at org.apache.bookkeeper.bookie.BookieShell.main(BookieShell.java:2463) ~[org.apache.bookkeeper-bookkeeper-server-4.16.0-SNAPSHOT.jar:4.16.0-SNAPSHOT]
   ledgermetadata: Print the metadata for a ledger, or optionally dump to a file.
   usage: ledgermetadata -ledgerid <ledgerid> [--dump-to-file
                         FILENAME|--restore-from-file FILENAME]
    -dumptofile <arg>        Dump metadata for ledger, to a file
    -l,--ledgerid <arg>      Ledger ID
    -restorefromfile <arg>   Restore metadata for ledger, from a file
   ```
   
   ### Changes
   Add `-h` and `--help` support.
   
   


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] hangc0276 commented on pull request #3227: Fix bookie shell help command exception

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3227:
URL: https://github.com/apache/bookkeeper/pull/3227#issuecomment-1107824583

   > How about adding a method `getOptionsWithHelp()` in `MyCommand`, that is
   > 
   > ```
   >         Options getOptionsWithHelp() {
   >             Options options = getOptions();
   >             options.addOption("h", "help", false, "show help");
   >             return options;
   >         }
   > ```
   > 
   > Then when running the command in the `MyCommand`, we use `getOptionsWithHelp` to parse the options.
   > 
   > So the change will be only in the MyCommand and we don't need to change other place?
   
   Good idea, I have updated the code.


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] hangc0276 commented on pull request #3227: Fix bookie shell help command exception

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3227:
URL: https://github.com/apache/bookkeeper/pull/3227#issuecomment-1107850399

   
   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] hangc0276 commented on pull request #3227: Fix bookie shell help command exception

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3227:
URL: https://github.com/apache/bookkeeper/pull/3227#issuecomment-1107854269

   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] hangc0276 commented on pull request #3227: Fix bookie shell help command exception

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3227:
URL: https://github.com/apache/bookkeeper/pull/3227#issuecomment-1107835699

   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] hangc0276 commented on pull request #3227: Fix bookie shell help command exception

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3227:
URL: https://github.com/apache/bookkeeper/pull/3227#issuecomment-1105962451

   ping @eolivelli @dlg99 @zymap, Please help take a look, thanks.


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] dlg99 merged pull request #3227: Fix bookie shell help command exception

Posted by GitBox <gi...@apache.org>.
dlg99 merged PR #3227:
URL: https://github.com/apache/bookkeeper/pull/3227


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] eolivelli commented on a diff in pull request #3227: Fix bookie shell help command exception

Posted by GitBox <gi...@apache.org>.
eolivelli commented on code in PR #3227:
URL: https://github.com/apache/bookkeeper/pull/3227#discussion_r854301302


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java:
##########
@@ -267,6 +271,7 @@ class MetaFormatCmd extends MyCommand {
             opts.addOption("f", "force", false,
                     "If [nonInteractive] is specified, then whether"
                             + " to force delete the old data without prompt.");
+            opts.addOption("h", "help", false, "Show the help");

Review Comment:
   is it possible to move this line to a common method or add some magic that automatically adds it always ?



-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] hangc0276 commented on pull request #3227: Fix bookie shell help command exception

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3227:
URL: https://github.com/apache/bookkeeper/pull/3227#issuecomment-1107845935

   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org