package sihl
 sectionYPositions = computeSectionYPositions($el), 10)"
  x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
  >
  
  
On This Page
  
  
  The modular functional web framework
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
  
    
      sihl-0.1.2.tbz
    
    
        
    
  
  
  
    
  
  
    
  
        sha256=69705a3a35f204acfdda62f61056e3f0ec3ef5bcd1df1508be65b066a0b1df9c
    
    
  sha512=1987d211f56d0261eefbae978065a4e6781d60ad94b08597875307e5cf6e5a1b79787d9c79f784f5a9f77c35203cfd0b488841a07adfd87b0710d6fd65422b94
    
    
  doc/sihl.cmd/Cmd/index.html
Module CmdSource
Use this module to create your own command line commands in order to interact with the Sihl app.
Services can register command with the command service. This is why a lot of services have a dependency on it. All the built-in commands are contributed by individual services using this mechanism. Examples for those commands are:
migrateis registered by the migration service and it runs the migrationsstartis registered by the web server service and it starts the web servercreateadminis registered by the user service and it creates an admin user, useful to bootstrap your app so you have one user to log in
You can contribute your custom commands the same way to interact with your app through the CLI. This can be very handy for development and administration. You sometimes want to call services without going through the HTTP stack, authentication, validation and authorization layers.
Source
val make : 
  name:Base.string ->
  ?help:Base.string ->
  description:Base.string ->
  fn:fn ->
  unit ->
  tUsage
This is how the command createadmin is implemented:
  let create_admin_cmd =
    Cmd.make ~name:"createadmin" ~help:"<username> <email> <password>"
      ~description:"Create an admin user"
      ~fn:(fun args ->
        match args with
        | [ username; email; password ] ->
            let ctx = Core.Ctx.empty |> DbService.add_pool in
            User_service.create_admin ctx ~email ~password ~username:(Some username)
            |> Lwt_result.map ignore
        | _ -> Lwt_result.fail "Usage: <username> <email> <password>")
      ()
  let _ =
    App.(empty
    |> with_services services
    |> with_commands [ create_admin_cmd ]
    |> run)
           sectionYPositions = computeSectionYPositions($el), 10)"
  x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
  >
  
  
  On This Page