nervosnetwork / ckb-cli

CKB command line interface
MIT License
55 stars 35 forks source link

Refactor plugin protocol to support git like subcommand plugin #505

Closed TheWaWaR closed 6 months ago

TheWaWaR commented 1 year ago

Support use a standalone executable binary as a plugin of ckb-cli, just like what git do.

For example:

ckb-cli light-client transfer --help

This will call a executable binary named ckb-cli-light-client and use transfer --help as it's arguments.

When call a plugin like above, ckb-cli will passing the ckb-cli home directory (default is $HOME/.ckb-cli) as CKB_CLI_HOME environment variable. And passing ckb rpc url as CKB_CLI_CKB_RPC environment variable.

So, we should add some functions into plugin-protocol help plugin use keystore from CKB_CLI_HOME or read ckb rpc url from CKB_CLI_CKB_RPC or other environment variables like this.