) -> Result<bool, String> {
let args = shlex::split(line).ok_or("error: Invalid quoting".to_string())?;
- let mut repl_args = vec!["repl".to_string()];
- repl_args.extend(args);
-
- let repl_subcommand = match ReplSubCommand::try_parse_from(&repl_args) {
+ let repl_subcommand = match ReplSubCommand::try_parse_from(&args) {
Ok(cmd) => cmd,
Err(e) => {
writeln!(std::io::stdout(), "{}", e).map_err(|e| e.to_string())?;
ReplSubCommand::Wallet { subcommand } => match subcommand {
WalletSubCommand::OfflineWalletSubCommand(cmd) => {
let mut ctx = AppContext::new_offline_wallet(network, datadir, wallet);
- cmd.execute(&mut ctx)
- .map_err(|e| e.to_string())?
- .write_out(std::io::stdout())
- .map_err(|e| e.to_string())?;
+ cmd.execute(&mut ctx).map_err(|e| e.to_string())?;
Some(())
}
#[cfg(any(
wallet_name.to_string(),
);
- cmd.execute(&mut ctx)
- .await
- .map_err(|e| e.to_string())?
- .write_out(std::io::stdout())
- .map_err(|e| e.to_string())?;
+ cmd.execute(&mut ctx).await.map_err(|e| e.to_string())?;
Some(())
}
- WalletSubCommand::Config(config_cmd) => {
- let mut ctx = AppContext::new(network, datadir);
- config_cmd
- .execute(&mut ctx)
- .map_err(|e| e.to_string())?
- .write_out(std::io::stdout())
- .map_err(|e| e.to_string())?;
+ WalletSubCommand::Config(_) => {
+ writeln!(
+ std::io::stdout(),
+ "`config` is not available in REPL mode — the wallet for this session \
+ is already loaded. Exit and run `bdk-cli wallet --wallet <name> config ...`."
+ )
+ .map_err(|e| e.to_string())?;
Some(())
}
},