Skip to content

util: Make -help more Unix and grep friendly#17841

Closed
cvengler wants to merge 1 commit intobitcoin:masterfrom
cvengler:2020-01-unix-and-grep-friendly-help
Closed

util: Make -help more Unix and grep friendly#17841
cvengler wants to merge 1 commit intobitcoin:masterfrom
cvengler:2020-01-unix-and-grep-friendly-help

Conversation

@cvengler
Copy link
Copy Markdown
Contributor

@cvengler cvengler commented Jan 1, 2020

This does not affect the Windows platform
The current --help overview is ugly and pretty uncommon for the GNU (and probably unix userland).
The biggest difference is that at Bitcoin Cores approach, there is a new line after every command. This isn't really friendly when using grep to get more informations about a command. Honestly IMO the current help page looks from its format more like a man rather than a help page.

As an example:
Current:

Chain selection options:

  -chain=<chain>
       Use the chain <chain> (default: main). Allowed values: main, test,
       regtest

  -testnet
       Use the test chain. Equivalent to -chain=test.

This PR:

Chain selection options:

  -chain=<chain>                         Use the chain <chain> (default: 
                                         main). Allowed values: main, test, 
                                         regtest 


  -testnet                               Use the test chain. Equivalent to 
                                         -chain=test. 


It also adds a limit of 41 characters per arg name. That's why I also changed the parameter description of -whitelist

@fanquake
Copy link
Copy Markdown
Member

fanquake commented Jan 1, 2020

Why are your vscode settings part of this pull request?

@cvengler cvengler force-pushed the 2020-01-unix-and-grep-friendly-help branch from 7a6888d to 8da847e Compare January 1, 2020 17:55
@cvengler
Copy link
Copy Markdown
Contributor Author

cvengler commented Jan 1, 2020

Why are your vscode settings part of this pull request?

I accidentally added them. Removed it

@fanquake
Copy link
Copy Markdown
Member

fanquake commented Jan 2, 2020

Concept -0.

"--help overview is ugly"

I disagree that this PR makes the --help output more readable than master.

there is a new line after every command. This isn't really friendly when using grep to get more informations about a command.

If you'd like more context when grepping, you can pass grep -A, -C etc. i.e:

src/bitcoind -help | grep rpccookiefile
  -rpccookiefile=<loc>
src/bitcoind -help | grep -A2 rpccookiefile
  -rpccookiefile=<loc>
       Location of the auth cookie. Relative paths will be prefixed by a
       net-specific datadir location. (default: data dir)

You need to fix all the unit tests that are failing. You should always be running the unit tests, and fixing all issues before opening a PR (src/test/test_bitcoin --run_test=util_tests).

This PR (8da847e):

  -upgradewallet                         Upgrade wallet to latest format on 
                                         startup 


  -wallet=<path>                         Specify wallet database path. Can be 
                                         specified multiple times to load 
                                         multiple wallets. Path is interpreted 
                                         relative to <walletdir> if it is not 
                                         absolute, and will be created if it 
                                         does not exist (as a directory 
                                         containing a wallet.dat file and log 
                                         files). For backwards compatibility 
                                         this will also accept names of 
                                         existing data files in <walletdir>.) 


  -walletbroadcast                       Make the wallet broadcast 
                                         transactions (default: 1) 

master (35fff5b):

  -upgradewallet
       Upgrade wallet to latest format on startup

  -wallet=<path>
       Specify wallet database path. Can be specified multiple times to load
       multiple wallets. Path is interpreted relative to <walletdir> if
       it is not absolute, and will be created if it does not exist (as
       a directory containing a wallet.dat file and log files). For
       backwards compatibility this will also accept names of existing
       data files in <walletdir>.)

  -walletbroadcast
       Make the wallet broadcast transactions (default: 1)

@maflcko
Copy link
Copy Markdown
Member

maflcko commented Jan 2, 2020

This breaks gen-manpages.sh, no?

@promag
Copy link
Copy Markdown
Contributor

promag commented Jan 2, 2020

And why keep windows different?

If the motivation is to make it grep friendly then I agree with @fanquake.

@laanwj
Copy link
Copy Markdown
Member

laanwj commented Jan 2, 2020

Meh. Also ~0 on this, "ugly" is a matter of taste and doesn't really have a place in these kind of arguments. I prefer the current syntax instead of columnar view.

As for grep-ability yea this will get you the first line, which isn't super useful. What I generally do is bitcoind --help | less and then search in there with /. This gets you the whole description and a way to browse it.

@jamesob
Copy link
Copy Markdown
Contributor

jamesob commented Jan 2, 2020

-0.001

Not worth the change, additional code. grep -C 3 works decently as-is.

@jonatack
Copy link
Copy Markdown
Member

jonatack commented Jan 2, 2020

-0.1, unneeded and non-issue, grepping with -A/B/C flags works well.

@cvengler cvengler closed this Jan 3, 2020
@cvengler
Copy link
Copy Markdown
Contributor Author

cvengler commented Jan 3, 2020

Lost motivation on this PR as it isn’t a real issue currently.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants