Module Webs_cli

Command line interface support.

Options

val listener : ?⁠opts:string list -> ?⁠docs:string -> ?⁠default_port:int -> ?⁠default_listener:Webs_unix.listener -> unit -> Webs_unix.listener Cmdliner.Term.t

listener is an option for specifying a connection listener.

  • default_port is the default port when unspecified (defaults to 8000).
  • default_listen is the default listener when unspecified (defaults to Webs_unix.listen_localhost).
  • docs is the section where the option is documented.
  • opts are the options to use (defaults to ["l";"listen"]).
val docroot : ?⁠opts:string list -> ?⁠docs:string -> unit -> string option Cmdliner.Term.t

docroot is an option for specifying an optional document root.

  • docs is the section where the option is documented.
  • opts are the options to use (defaults to ["d";"docroot"]).

Quick service setup

val conf_docroot : unit -> (string, string) Stdlib.result Cmdliner.Term.t

conf_docroot () requires a docroot option, realpathes is and logs it.

val quick_serve : ?⁠version:string -> ?⁠man:Cmdliner.Manpage.block list -> ?⁠doc:string -> name:string -> Webs.service -> unit

quick_serve ~name (Ok s) runs s with the Webs_httpc and handles a few default command line options. If you want to be able to specify a docroot on the command line you need to specify with_docroot:true. There is no default for docroots it always needs to be specified explicitely.

val quick_serve' : ?⁠version:string -> ?⁠man:Cmdliner.Manpage.block list -> ?⁠doc:string -> name:string -> conf:('a, string) Stdlib.result Cmdliner.Term.t -> ('a -> Webs.service) -> unit

quick_serve' is like quick_serve but additional configuration parameters can be parsed from the command line and be checked before installing the service.