-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cmdliner composability #59
Comments
I don't know if this should be a separate issue...
on connection reset by browser, that causes whole process to crash. |
afaict, there is also no way for the user to inspect the values that can be passed in from This leads to somewhat confusing behavior and idioms like opium/examples/hello_world_log.ml Lines 28 to 32 in 3b68fac
Apparently this is what we need to do to setup a logger, but then it seems that the logger must have it's log level hard coded, so I wonder I wonder what the log level CLI flags are for! :) |
@shonfeder Which log level flags are you referring to? Opium uses some I might start a mld doc to showcase some examples and pointing out some libraries that can be used with opium for common workflows. |
Ah yes, thanks @anuragsoni. I've been digging in to the source code to figure out what's going on here, and I see that the |
Yeah, the log level filter and the log reporter will indeed be on the application to specify. |
I had the same problem, Opium Cmdliner got in confusion with my execution Framework, overriding my Cmdliner usage. For what it is worth now, you can avoid the Opium Cmdliner call using the Opium.start function yourself. let make_app (conf : MyConfiguration.t) : Opium.App.t =
Opium.App.empty
|> Opium.App.cmd_name conf.name
|> Opium.App.port conf.port
let run_opium_server app =
let open Lwt.Syntax in
Lwt.async (fun () ->
let* _server = Opium.App.start app in
Lwt.return_unit);
let forever, _ = Lwt.wait () in
forever
let any_other_jobs () = Lwt.return_unit
let main () =
let%lwt c = MyConfiguration.load () in
let app = make_app c in
Lwt.join [run_opium_server app; any_other_jobs ()]
let () = Lwt_main.run @@ main |
Opium has Cmdliner term/args for convenience but these are no longer useful when a user wants their own CLI. Perhaps we can still expose the terms/args Opium defines to make it easier for people to construct their own CLI's.
The text was updated successfully, but these errors were encountered: