Bash auto-completion for cardano-cli

If you are training on Shelley testnet, following IOHK tutorials, you are likely to type a lot of cardano-cli long commands, so having bash completion is handy:

Just run:

source <(cardano-cli --bash-completion-script cardano-cli)

Then press TAB to complete the current command or option, for example:

$ cardano-cli sh[TAB]
$ cardano-cli shelley tr[TAB]
$ cardarno-cli shelley transaction calc[TAB]
$ cardano-cli shelley transaction calculate-min-fee --[TAB]
--certificate-file      --protocol-params-file  --ttl                   --withdrawal
--has-metadata          --signing-key-file      --tx-in-count           
--mainnet               --testnet-magic         --tx-out-count   

You can also configure it for all future shell sessions, and for cardano-node too, see the small note here: cardano-cli Bash auto-completion .

That’s it. I did not see it documented in the tutorials or elsewhere, so I thought it could be helpful.

Happy staking,
[SM₳UG]

5 Likes