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

pull emilengler wants to merge 1 commits into bitcoin:master from emilengler:2020-01-unix-and-grep-friendly-help changing 3 files +36 −1
  1. emilengler commented at 6:15 AM on January 1, 2020: contributor

    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

  2. DrahtBot added the label Utils/log/libs on Jan 1, 2020
  3. fanquake commented at 12:23 PM on January 1, 2020: member

    Why are your vscode settings part of this pull request?

  4. util: Make -help more Unix and grep friendly 8da847ef6f
  5. emilengler force-pushed on Jan 1, 2020
  6. emilengler commented at 5:56 PM on January 1, 2020: contributor

    Why are your vscode settings part of this pull request?

    I accidentally added them. Removed it

  7. fanquake commented at 4:36 AM on January 2, 2020: member

    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 (8da847ef6f3893f922eec0dd27b3762aedefebb2):

      -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 (35fff5be60e853455abc24713481544e91adfedb):

      -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)
    
  8. MarcoFalke commented at 3:27 PM on January 2, 2020: member

    This breaks gen-manpages.sh, no?

  9. promag commented at 4:42 PM on January 2, 2020: member

    And why keep windows different?

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

  10. laanwj commented at 4:47 PM on January 2, 2020: member

    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.

  11. jamesob commented at 4:58 PM on January 2, 2020: member

    -0.001

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

  12. jonatack commented at 6:00 PM on January 2, 2020: member

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

  13. emilengler closed this on Jan 3, 2020

  14. emilengler commented at 3:36 AM on January 3, 2020: contributor

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

  15. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me