rp: Add exchange-config command

This is similar to `rosenpass exchange`/`rosenpass exchange-config`.
It's however slightly different to the configuration file models the `rp
exchange` command line.
This commit is contained in:
Jacek Galowicz
2024-11-14 14:09:23 +00:00
committed by Paul Spooren
parent 022cdc4ffa
commit cd7558594f
5 changed files with 36 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
use std::process::exit;
use std::{fs, process::exit};
use cli::{Cli, Command};
use exchange::exchange;
@@ -36,6 +36,13 @@ async fn main() {
options.verbose = cli.verbose;
exchange(options).await
}
Command::ExchangeConfig { config_file } => {
let s: String = fs::read_to_string(config_file).expect("cannot read config");
let mut options: exchange::ExchangeOptions =
toml::from_str::<exchange::ExchangeOptions>(&s).expect("cannot parse config");
options.verbose = options.verbose || cli.verbose;
exchange(options).await
}
Command::Help => {
println!("Usage: rp [verbose] genkey|pubkey|exchange [ARGS]...");
Ok(())