Skip to content

Commit

Permalink
Add dump-data-json subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
ushitora-anqou committed Sep 26, 2023
1 parent ce4af95 commit 0a50e8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ let () =
const generate
$ Arg.(
required & pos 0 (some int) None & info ~docv:"NUM-ENTRIES" []));
v (info "dump-data-json")
Term.(
const dump_data_json
$ Arg.(
required & pos 0 (some string) None & info ~docv:"IN-FILE" []));
]
|> eval)
|> exit
5 changes: 5 additions & 0 deletions lib/command.ml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ let serve =

let generate num_entries =
Generator.generate_sample num_entries |> print_endline

let dump_data_json in_filename =
Lwt_main.run
(Web_server.generate_json in_filename
>|= Yojson.Safe.to_string >|= print_string)

0 comments on commit 0a50e8b

Please sign in to comment.