Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,30 @@ directly from [crates.io](https://crates.io/crates/bdk-cli) with a command as be
```sh
cargo install bdk-cli --features electrum
```
## Command Aliases

bdk-cli provides short aliases for commonly used commands to improve CLI ergonomics.

### Top-level command aliases

| Command | Alias |
|------------|-------|
| wallet | W |
| key | K |
| compile | C |
| repl | R |
| descriptor | D |

### Wallet subcommand aliases

| Command | Alias |
|---------------------|-------|
| new_address | new_addr |
| unused_address | unused_addr |
| create_tx | create |
| bump_fee | bump |
| public_descriptor | pub_desc |


### bdk-cli bin usage examples

Expand Down
12 changes: 11 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ pub struct CliOpts {
/// Top level cli sub-commands.
#[derive(Debug, Subcommand, Clone, PartialEq)]
#[command(rename_all = "snake")]

pub enum CliSubCommand {
/// Wallet operations.
///
/// bdk-cli wallet operations includes all the basic wallet level tasks.
/// Most commands can be used without connecting to any backend. To use commands that
/// needs backend like `sync` and `broadcast`, compile the binary with specific backend feature
/// and use the configuration options below to configure for that backend.
#[command(alias = "W")]
Wallet {
#[command(flatten)]
wallet_opts: WalletOpts,
Expand All @@ -81,13 +83,14 @@ pub enum CliSubCommand {
///
/// These sub-commands are **EXPERIMENTAL** and should only be used for testing. Do not use this
/// feature to create keys that secure actual funds on the Bitcoin mainnet.
#[command(alias = "K")]
Key {
#[clap(subcommand)]
subcommand: KeySubCommand,
},
/// Compile a miniscript policy to an output descriptor.
#[cfg(feature = "compiler")]
#[clap(long_about = "Miniscript policy compiler")]
#[command(alias = "C", long_about = "Miniscript policy compiler")]
Compile {
/// Sets the spending policy to compile.
#[arg(env = "POLICY", required = true, index = 1)]
Expand All @@ -98,6 +101,7 @@ pub enum CliSubCommand {
script_type: String,
},
#[cfg(feature = "repl")]
#[command(alias = "R")]
/// REPL command loop mode.
///
/// REPL command loop can be used to make recurring callbacks to an already loaded wallet.
Expand All @@ -110,6 +114,7 @@ pub enum CliSubCommand {
///
/// Generate output descriptors from either extended key (Xprv/Xpub) or mnemonic phrase.
/// This feature is intended for development and testing purposes only.
#[command(alias = "D")]
Descriptor {
/// Descriptor type (script type)
#[arg(
Expand Down Expand Up @@ -268,8 +273,10 @@ pub struct CompactFilterOpts {
#[command(rename_all = "snake")]
pub enum OfflineWalletSubCommand {
/// Get a new external address.
#[command(alias = "new_addr")]
NewAddress,
/// Get the first unused external address.
#[command(alias = "unused_addr")]
UnusedAddress,
/// Lists the available spendable UTXOs.
Unspent,
Expand All @@ -278,6 +285,7 @@ pub enum OfflineWalletSubCommand {
/// Returns the current wallet balance.
Balance,
/// Creates a new unsigned transaction.
#[command(alias = "create")]
CreateTx {
/// Adds a recipient to the transaction.
// Clap Doesn't support complex vector parsing https://github.com/clap-rs/clap/issues/1704.
Expand Down Expand Up @@ -326,6 +334,7 @@ pub enum OfflineWalletSubCommand {
add_data: Option<String>, //base 64 econding
},
/// Bumps the fees of an RBF transaction.
#[command(alias = "bump")]
BumpFee {
/// TXID of the transaction to update.
#[arg(env = "TXID", long = "txid")]
Expand Down Expand Up @@ -354,6 +363,7 @@ pub enum OfflineWalletSubCommand {
/// Returns the available spending policies for the descriptor.
Policies,
/// Returns the public version of the wallet's descriptor(s).
#[command(alias = "pub_desc")]
PublicDescriptor,
/// Signs and tries to finalize a PSBT.
Sign {
Expand Down