Don't hide default port

This commit is contained in:
Reynir Björnsson 2024-05-31 13:26:34 +02:00
parent 8e79cb49ee
commit 6ad5c9515e

View file

@ -18,8 +18,7 @@ let program ~target =
let local_build _quiet target = let local_build _quiet target =
Yocaml_unix.execute (program ~target:(Fpath.to_string target)) Yocaml_unix.execute (program ~target:(Fpath.to_string target))
let watch quiet target potential_port = let watch quiet target port =
let port = Option.value ~default:default_port potential_port in
let () = local_build quiet target in let () = local_build quiet target in
let target = Fpath.to_string target in let target = Fpath.to_string target in
let server = Yocaml_unix.serve ~filepath:target ~port (program ~target) in let server = Yocaml_unix.serve ~filepath:target ~port (program ~target) in
@ -92,7 +91,7 @@ let watch_cmd =
let port_arg = let port_arg =
let doc = "The port" in let doc = "The port" in
let arg = Arg.info ~doc [ "port"; "P"; "p" ] in let arg = Arg.info ~doc [ "port"; "P"; "p" ] in
Arg.(value & opt (some int) None & arg) Arg.(value & opt int default_port & arg)
in in
let info = Cmd.info "watch" ~version ~doc ~exits ~man in let info = Cmd.info "watch" ~version ~doc ~exits ~man in
Cmd.v info Term.(const watch $ setup_logs $ path_arg $ port_arg) Cmd.v info Term.(const watch $ setup_logs $ path_arg $ port_arg)