package sihl

  1. Overview
  2. Docs
The modular functional web framework

Install

Dune Dependency

Authors

Maintainers

Sources

sihl-queue-0.1.7.tbz
sha256=a432c28b88610b8ef914aa93d1be5bf3ad4b357ebaa8e95848e981ea30611cd4
sha512=e85a2c2935973826ef29191d6a784dca53660c8df55a98174d7326a8a73865cf7f35bfae034b179d85f30bb809985da3c6d170608da2e9ac9763b8fd1f8a1a4e

doc/sihl.core/Sihl_core/Command/index.html

Module Sihl_core.CommandSource

A module to register and run CLI commands.

A CLI command is the entry t a Sihl app. Services contribute their own set of commands, making every Sihl app and the available commands per Sihl app dynamic and dependent on the set of active services.

Sourcetype fn = string list -> unit Lwt.t

A function that takes a list of strings as argument and does some side effect.

Sourcetype t = {
  1. name : string;
  2. help : string option;
  3. description : string;
  4. fn : fn;
}

A CLI command has a unique name, an optional help text that shows the usage, a description that gives background information and the actual CLI function.

Sourceexception Exception of string
Sourceval make : name:string -> ?help:string -> description:string -> fn -> t

Running commands

Sourceval run : t list -> string list option -> unit Lwt.t

Call run commands args in the main Sihl app executable to pass command line arguments to all registered commands. This is the main entry point to a Sihl app. An optional list of arguments args can be passed, if None is passed, it reads the arguments from Sys.argv.

Utilities

Sourceval sexp_of_t : t -> Sexplib0.Sexp.t

sexp_of_t t converts the command t to an s-expression

Sourceval pp : Format.formatter -> t -> unit

pp formats the command t as an s-expression

OCaml

Innovation. Community. Security.