contrib: Autogenerate bash completion #17289

issue MarcoFalke openend this issue on October 28, 2019
  1. MarcoFalke commented at 7:51 pm on October 28, 2019: member

    We have a bash completion file, which needs to be updated manually: #17282 (comment)

    However, given our argparse module and RPCHelpMan, I believe it should be possible to autogenerate it with maybe a python script.

    If it should be necessary to run a bitcoind instance as an http server for rpc request to auto-generate the bash completion, this could be implemented as a functional test (written in python).

  2. MarcoFalke added the label Feature on Oct 28, 2019
  3. MarcoFalke added the label good first issue on Oct 28, 2019
  4. MarcoFalke added the label Hacktoberfest on Oct 28, 2019
  5. pierreN commented at 3:38 pm on April 12, 2020: contributor
    Just sent a PR to implement this a functional test : https://github.com/bitcoin/bitcoin/pull/18606
  6. luke-jr commented at 4:46 pm on April 23, 2020: member
    Now that we have object-based help, perhaps we should add JSON output to the help method, and adapt the bash completion to be automatic at runtime?
  7. MarcoFalke commented at 4:48 pm on April 23, 2020: member
    @luke-jr Not sure if a round-trip to the server is a good user experience for bash completion, especially in IBD
  8. luke-jr commented at 5:10 pm on April 23, 2020: member
    IBD shouldn’t affect help lookups..
  9. pierreN commented at 0:21 am on April 24, 2020: contributor

    @luke-jr by object-based help, you mean #18531, or did I miss a PR by any chance?

    I’d tend to agree with @MarcoFalke here: doing bitcoin-cli -> RPC -> bitcoin-node -> RPC -> bitcoin-cli every time the user types TAB might feel a bit sluggish especially when the node is running on really low-end ARM hardware (plus with loads from other bitcoind threads on top of that).

    (and you’d have to have a node running (with RPC configured) to have auto-completion which might not be a great user experience for first-time users)

    But both approaches are valid and if enough people think we should call bitcoind for autocomplete, I’d be happy to modify the PR to do that.

  10. luke-jr commented at 0:40 am on April 24, 2020: member

    @luke-jr by object-based help, you mean #18531, or did I miss a PR by any chance?

    I mean something hypothetical where the help is returned as JSON Object similar to how we create it.

    I’d tend to agree with @MarcoFalke here: doing bitcoin-cli -> RPC -> bitcoin-node -> RPC -> bitcoin-cli every time the user types TAB might feel a bit sluggish

    Doesn’t seem sluggish for SSH over a network…? (scp has tab-completion)

    especially when the node is running on really low-end ARM hardware

    It can’t do a simple RPC request, but it can run a full node? :p

  11. pierreN commented at 1:17 am on April 24, 2020: contributor

    I mean something hypothetical where the help is returned as JSON Object similar to how we create it.

    Ow ok, I see thanks. Yes sure it shouldn’t be complicated to write something like https://github.com/pierreN/bitcoin/blob/feature-auto-cli/test/functional/tool_cli_completion.py inside bitcoind.

    Doesn’t seem sluggish for SSH over a network…? (scp has tab-completion)

    That’s actually what I had in mind. On really low-end ARM server (I’m using this for example) the first times you try to auto-complete via ssh it takes a few seconds and that’s just annoying. And that is assuming you don’t have a passphrase for your local key (e.g. RPC identifier in the bitcoind case)

    It can’t do a simple RPC request, but it can run a full node? :package:

    Sorry I wasn’t clear. I just meant it was a latency issue. Yes, auto-completing via RPC requests would work, it just would be slower on low-end hardware.

  12. meshcollider removed the label Hacktoberfest on Oct 4, 2021

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: 2024-12-04 06:12 UTC

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