JJ: Description from the destination commit:

setup_cmd: add --output-pubkey

JJ: Description from source commit:
use cmdliner
This commit is contained in:
swrup 2026-02-17 05:19:17 +01:00
parent eddc8127a1
commit 2220f66db7
6 changed files with 186 additions and 131 deletions

View file

@ -1,13 +1,7 @@
(* TODO
better cmd doc
change arguments: '_' -> '-'
all management operations:
/management/wire
/management/wire/disable
-> how to build WireSetupMessage?
we need additional data to craft master_sig
maybe supposed to be found in the full payto-uri?
/management/aml-officers
-> /aml
@ -85,25 +79,40 @@ let url =
Arg.(required & opt (some string) None & info [ "url" ] ~doc)
let setup_cmd =
let doc = "Generate offline master keys" in
let doc =
"Generate offline master keys, write private and public key to file"
in
let output =
let doc = "output file" in
let doc = "private key output file" in
Arg.(required & opt (some filepath) None & info [ "o"; "output" ] ~doc)
in
let output_pubkey =
let doc =
"public key output file, default to --output parameter with a \".pub\" \
extension"
in
Arg.(value & opt (some filepath) None & info [ "output-pubkey" ] ~doc)
in
Cmd.make (Cmd.info "setup" ~doc)
@@
let+ output = output in
setup ~output
let+ output = output and+ output_pubkey = output_pubkey in
let output_pubkey = Option.value ~default:(output ^ ".pub") output_pubkey in
setup ~output ~output_pubkey
let download_cmd =
let doc = "GET" in
let doc =
"use curl to send a GET request to --url, write response body to --output"
in
Cmd.make (Cmd.info "download" ~doc)
@@
let+ output = output and+ url = url in
download ~output ~url
let upload_cmd =
let doc = "POST" in
let doc =
"use curl to send a POST request to --url, with request body set to \
--input file content"
in
Cmd.make (Cmd.info "upload" ~doc)
@@
let+ input = input and+ url = url in