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
Added a cli infrastructure #7094
Conversation
String cmdName = args[0]; | ||
cmd = config.cmd(cmdName); | ||
if (cmd == null) { | ||
terminal.printError("unknown command [%s]. Use [-h] option to list available commands", cmdName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possible use of config.printUsage
here as well or directly list available commands to be more user friendly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought about it... decided to only leave it with a comment about -h
... could very well be that the user just accidentally mistyped and didn't want to make things too verbose
Left a few comments, mostly about the tests. I like the idea a in general, a bit worried about the performance (didnt test anything, maybe I am plain wrong here), but I'd like to see the PluginManager adapted as part of this PR to make sure everything works as we expect and all features are covered instead of finding out later, that we cannot do everything needed with this. |
* | ||
* Two modes are supported: | ||
* | ||
* - Singe command mode. The tool exposes a single command that can potentially accept arguments (eg. CLI options). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Singe/Single
@spinscale thanks for the review... I'd like have the plugin manager implemented in a separate PR - its own PR as part of the work there is to change how it works (right now, aside from being a mess, it's also not consistent with its supported options). If we find things missing in the infra, we can always add those later. |
updated based on comments by @spinscale
|
CliTool is a base class for command-line interface tools (such as the plugin manager and potentially others). It supports the following: - single or multi command tool - help printing infrastructure (based on help files) - consistent mechanism of parsing arguments (based on commons-cli lib) - separation of argument parsing and command execution (for easier unit testing) - terminal abstraction (will use System.console() when available)
CliTool is a base class for command-line interface tools (such as the plugin manager and potentially others). It supports the following: