package sihl
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=b264f357c2a65dbed00c3459be76cdd9b21275aeb9d0289634a2050161665211
sha512=b22fa96a3c7fa607df04848b40a0f54890f4f63c519d10ff7fcef8ccf09341731b42ff4decccb4a7e858e138a803c849ee0c5226c514938cdcded2fd80cae4cb
doc/sihl.core/Sihl_core/App/index.html
Module Sihl_core.App
Source
A module to create Sihl apps.
An app is a thin convenience layer on top of the service container. It provides hooks that are executed at different stages in the app lifecycle.
with_services services app
adds services
to an app
.
before_start f app
registers a callback f with app
. The callback is executed before any service is started. This means you must not use any services here!
after_stop f app
registers a callback f with app
. The callback is executed before after services are stopped. This means you must not use any services here!
val run :
?commands:Command.t list ->
?log_reporter:(unit -> Logs.reporter) ->
?args:string list ->
t ->
unit
run ?commands ?log_reporter app
is the main entry point to a Sihl app and starts the command line interface with commands
merged with the commands provided by services.
An optional log_reporter
can be provided to change the logging behavior. The default log reporter logs to stdout.
val run' :
?commands:Command.t list ->
?log_reporter:(unit -> Logs.reporter) ->
?args:string list ->
t ->
unit Lwt.t
run' ?commands ?log_reporter app
is analogous to run
. It is a helper to be used in tests that need Lwt.t
.