|
@@ -24,7 +24,8 @@ use std::{
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
use anyhow::{anyhow, Context, Result};
|
|
use anyhow::{anyhow, Context, Result};
|
|
|
-use clap::{Parser, Subcommand};
|
|
|
|
|
|
|
+use clap::{CommandFactory, Parser, Subcommand};
|
|
|
|
|
+use clap_complete::{generate, Shell};
|
|
|
use darkfi::{tx::Transaction, util::parse::decode_base10, zk::halo2::Field};
|
|
use darkfi::{tx::Transaction, util::parse::decode_base10, zk::halo2::Field};
|
|
|
use darkfi_money_contract::client::Coin;
|
|
use darkfi_money_contract::client::Coin;
|
|
|
use darkfi_sdk::{
|
|
use darkfi_sdk::{
|
|
@@ -94,6 +95,12 @@ enum Subcmd {
|
|
|
/// Send a ping request to the darkfid RPC endpoint
|
|
/// Send a ping request to the darkfid RPC endpoint
|
|
|
Ping,
|
|
Ping,
|
|
|
|
|
|
|
|
|
|
+ /// Generate a SHELL completion script and print to stdout
|
|
|
|
|
+ Completions {
|
|
|
|
|
+ /// The Shell you want to generate script for
|
|
|
|
|
+ shell: Shell,
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
/// Wallet operations
|
|
/// Wallet operations
|
|
|
Wallet {
|
|
Wallet {
|
|
|
#[arg(long)]
|
|
#[arg(long)]
|
|
@@ -415,6 +422,12 @@ async fn main() -> Result<()> {
|
|
|
|
|
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
+ Subcmd::Completions { shell } => {
|
|
|
|
|
+ let mut cmd = Args::command();
|
|
|
|
|
+ generate(shell, &mut cmd, "./drk", &mut std::io::stdout());
|
|
|
|
|
+
|
|
|
|
|
+ Ok(())
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
Subcmd::Wallet {
|
|
Subcmd::Wallet {
|
|
|
initialize,
|
|
initialize,
|