This commit is contained in:
parent
1cb9d3e60b
commit
176ddbd586
4 changed files with 15 additions and 8 deletions
|
|
@ -3,6 +3,7 @@
|
|||
- setup
|
||||
- sign *)
|
||||
(* doc: https://docs.taler.net/manpages/taler-exchange-offline.1.html *)
|
||||
let version = "%%VERSION%%"
|
||||
|
||||
let download ~base_url ~output =
|
||||
let open Bos in
|
||||
|
|
@ -53,7 +54,7 @@ let setup_cmd =
|
|||
& opt filepath "data/eddsa_master_offline"
|
||||
& info [ "o"; "output" ] ~doc)
|
||||
in
|
||||
Cmd.make (Cmd.info "setup" ~version:"%%VERSION%%" ~doc)
|
||||
Cmd.make (Cmd.info "setup" ~version ~doc)
|
||||
@@
|
||||
let+ output = output in
|
||||
match setup ~output with
|
||||
|
|
@ -75,7 +76,7 @@ let download_cmd =
|
|||
let doc = "Base url of the exchange." in
|
||||
Arg.(value & opt string "http://localhost:3434/" & info [ "base-url" ] ~doc)
|
||||
in
|
||||
Cmd.make (Cmd.info "download" ~version:"%%VERSION%%" ~doc ~man)
|
||||
Cmd.make (Cmd.info "download" ~version ~doc ~man)
|
||||
@@
|
||||
let+ output = output and+ base_url = base_url in
|
||||
match download ~base_url ~output with
|
||||
|
|
@ -104,7 +105,7 @@ let sign_cmd =
|
|||
& opt filepath "data/eddsa_master_offline"
|
||||
& info [ "master-key" ] ~doc)
|
||||
in
|
||||
Cmd.make (Cmd.info "sign" ~version:"%%VERSION%%" ~doc)
|
||||
Cmd.make (Cmd.info "sign" ~version ~doc)
|
||||
@@
|
||||
let+ input = input and+ output = output and+ master_key = master_key in
|
||||
match sign ~input ~output ~master_key with
|
||||
|
|
@ -113,7 +114,12 @@ let sign_cmd =
|
|||
exit 1
|
||||
| Ok () -> ()
|
||||
|
||||
let main () = Cmd.eval setup_cmd
|
||||
let _main () = Cmd.eval download_cmd
|
||||
let __main () = Cmd.eval sign_cmd
|
||||
let () = if !Sys.interactive then () else exit (main ())
|
||||
let cli =
|
||||
let info =
|
||||
let doc = "MTE Offline CLI tool" in
|
||||
Cmd.info "mte-offline" ~version ~doc
|
||||
in
|
||||
Cmd.group info [ setup_cmd; download_cmd; sign_cmd ]
|
||||
|
||||
let main () = Cmd.eval cli
|
||||
let () = exit (main ())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue