add cli parsing

This commit is contained in:
fbock
2024-05-28 18:00:53 +00:00
parent e599a08753
commit 597c28e1ef
8 changed files with 1472 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
./taptrade-cli-demo/target
taptrade-cli-demo/target

View File

@ -16,7 +16,7 @@
"file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas",
"viewState": {
"x": 127.5,
"y": 1104.1656242336394,
"y": 870.3121012187327,
"zoom": -0.787814735661959
}
}

1429
taptrade-cli-demo/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
[package]
name = "taptrade-cli-demo"
version = "0.1.0"
edition = "2021"
[dependencies]
bdk = "0.29.0"
clap = { version = "4.5.4", features = ["derive", "cargo"] }
frost-secp256k1 = "1.0.0"

View File

@ -0,0 +1,4 @@
// pass data to other module running on other process or machine
// (exchange data between coordinator and traders)

View File

View File

@ -0,0 +1,27 @@
use clap::{command, Arg};
mod trader;
mod coordinator;
fn main() {
let cli_args = command!()
.about("RoboSats taproot onchain trade pipeline CLI demonstrator. Don't use with real funds.")
.arg(
Arg::new("mode")
.short('m')
.long("mode")
.required(true)
.help("Mode: coordinator, maker or taker"))
.arg(
Arg::new("endpoint")
.short('p')
.long("endpoint")
.help("Communication endpoint of the coordinator to connect to")
// .conflicts_with("coordinator")
) // only required for traders
.get_matches();
}
// use clap to parse mode (taker, maker or coordinator), communication endpoint (URL or PID or something else), electrum server
// https://www.youtube.com/watch?v=Ot3qCA3Iv_8
// clap tutorial (min 32)

View File