-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Redesign CLI help output #1961
Merged
Merged
Redesign CLI help output #1961
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prior to this commit, help output for Bisq executables, e.g. Bisq Desktop itself used JOptSimple's default HelpFormatter implementation, which creates a quite cramped and hard-to-read output. This commit introduces a custom HelpFormatter implementation modeled after bitcoind's own help output. It maximizes readability while making full use of an 80-character width.
This change eliminates the BisqExecutable.description method and replaces it with proper use of the `describedAs` and `defaultsTo` methods in the JOptSimple API. This removes the concern of formatting option argument descriptions and default values from the BisqExecutable class, and delegates it to the new BisqHelpFormatter (see previous commit), which is designed for the purpose. For example, prior to this commit, the help text for the --banList option read as follows: --banList=<value> Nodes to exclude from network connections. (default: ) Now it reads as follows: --banList=<host:port[,...]> Nodes to exclude from network connections. Likewise, previous to this commit, the --logLevel option read as follows: --logLevel=<value> Log level [OFF, ALL, ERROR, WARN, INFO, DEBUG, TRACE] (default: INFO) And now it reads like this: --logLevel=<OFF|ALL|ERROR|WARN|INFO|DEBUG|TRACE> (default: INFO) Log level There are a number of further improvements that can and should be made to the description text of the various options, the types specified for their arguments, etc, but these will be handled in subsequent commits. This commit is strictly about refactoring existing parser configuration to take advantage of the new BisqHelpFormatter.
ManfredKarrer
approved these changes
Nov 24, 2018
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.
utACK
cbeams
added a commit
to cbeams/bisq
that referenced
this pull request
Dec 5, 2018
This change fixes bisq-network#2048 by removing the assignment of a default value for the `baseCurrencyNetwork` option at the level of the command line option parser. The assignment of this default was an oversight in bisq-network#1961 (specifically commit 83e1dd3) that did not account for the fact that users can change the `baseCurrencyNetwork` value via the Settings screen in the application. When users change the setting in the application, the new value is persisted to <appDataDir>/bisq.properties, which is handled at runtime as a PropertySource with lower precedence than the command line property source, which means that the changed value is never picked up because the higher-precedence command line PropertySource always has a default value. This fix is surgical in that it addresses only this specific option. A subsequent change should address the more general issue that setting defaults in the command line option parser always precludes the possibility of overriding them in bisq.properties. Basically, we should revert to the previous strategy of reporting what the default value will be in the help text without actually assigning a default value in the option parser using the `defaultsTo` method.
This was referenced Dec 7, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this pull request, Bisq's
--help
output looked like this:Now it reads as follows:
This new help format is modeled after bitcoind's own help output, which reads as follows:
The goal is to maximize readibility, make best use of the available 80-character width and to present Bisq's command line interface in a way that is friendly and familiar to those well-versed in *nix idioms.
Reviewers, please look through the commits one-by-one and read the detailed commit comments, thanks.