Page MenuHomePhabricator

[doc] Add notes on how to activate bash completion for locally built binaries
ClosedPublic

Authored by sdulfari on Jan 9 2023, 23:34.

Details

Summary

This does not appear to be officially supported (see https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html) but works well enough on Debian that its worth sharing.

I purposefully did not amend the ./contrib/*.bash-completion files to include
relative paths to binaries since this may have negative impacts for some users.
For example, ./bitcoin-cli would match for any bitcoin software fork that has
not renamed the bitcoin-cli binary. This could result in completions applied
to the wrong binaries. It is best to leave this decision to the user since they
can source different .bash-completion files only in the appropriate session.

Test Plan
source ./contrib/bitcoind.bash-completion
complete -F _bitcoind ./bitcoind
mkdir build && cd build && cmake -GNinja .. && ninja
./src/bitcoind -testnet -daemon   # type this out using tab-completion
cd src
./bitcoin-cli -testnet   # type this out using tab-completion, hit space then
                         # tab again to see RPC commands

Note: bitcoind must be running in order for RPC command tab completion to work.
This is expected.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sdulfari requested review of this revision.Jan 9 2023, 23:34
Fabien requested changes to this revision.Jan 10 2023, 08:03
Fabien added a subscriber: Fabien.
Fabien added inline comments.
doc/productivity.md
70 ↗(On Diff #37498)

The path to bitcoind and bitcoin-cli is not an out-of-tree build, it's at the root of the repo which is weird.
IMO you should just leave a meta path, like <path_to_bitcoind> in your example.

This revision now requires changes to proceed.Jan 10 2023, 08:03
Fabien added inline comments.
doc/productivity.md
75 ↗(On Diff #37498)

After a (long) slack discussion/explanation, it appears that this path is a name and does match any subdir, not like a direct call to ./bitcoind.

This revision is now accepted and ready to land.Jan 10 2023, 20:52