This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
31
unikernel/duniverse/mirage/test/functoria/e2e/app/app.ml
Normal file
31
unikernel/duniverse/mirage/test/functoria/e2e/app/app.ml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
open Cmdliner
|
||||
|
||||
let opt =
|
||||
let doc = Arg.info ~doc:"An optional key." [ "opt" ] in
|
||||
Arg.(value & opt string "default" doc)
|
||||
|
||||
let opt_all =
|
||||
let doc = Arg.info ~doc:"All the optional keys." [ "opt-all" ] in
|
||||
Arg.(value & opt_all string [] doc)
|
||||
|
||||
let flag =
|
||||
let doc = Arg.info ~doc:"A flag." [ "flag" ] in
|
||||
Arg.(value & flag doc)
|
||||
|
||||
let required =
|
||||
let doc = Arg.info ~doc:"A required key." [ "required" ] in
|
||||
Arg.(required & opt (some string) None doc)
|
||||
|
||||
let hello =
|
||||
let doc = Arg.info ~doc:"How to say hello." [ "hello" ] in
|
||||
Arg.(value @@ opt string "Hello World!" doc)
|
||||
|
||||
let arg =
|
||||
let doc =
|
||||
Arg.info ~docs:"APPLICATION OPTIONS" ~doc:"A runtime argument." [ "arg" ]
|
||||
in
|
||||
Arg.(value & opt string "-" doc)
|
||||
|
||||
module Make (_ : sig end) = struct
|
||||
let start () hello arg = Fmt.pr "Success: hello=%s arg=%s\n%!" hello arg
|
||||
end
|
||||
30
unikernel/duniverse/mirage/test/functoria/e2e/app/config.ml
Normal file
30
unikernel/duniverse/mirage/test/functoria/e2e/app/config.ml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
open Functoria
|
||||
open E2e
|
||||
|
||||
let opt = runtime_arg ~pos:__POS__ "App.opt"
|
||||
let opt_all = runtime_arg ~pos:__POS__ "App.opt_all"
|
||||
let flag = runtime_arg ~pos:__POS__ "App.flag"
|
||||
let required = runtime_arg ~pos:__POS__ "App.required"
|
||||
|
||||
let runtime_args =
|
||||
[ runtime_arg ~pos:__POS__ "App.hello"; runtime_arg ~pos:__POS__ "App.arg" ]
|
||||
|
||||
let keys =
|
||||
let connect _ _ = function
|
||||
| [ opt; opt_all; flag; required ] ->
|
||||
code ~pos:__POS__
|
||||
{|
|
||||
let _ : string = %s
|
||||
and _ : string list = %s
|
||||
and _ : bool = %s
|
||||
and _ : string = %s
|
||||
in
|
||||
return ()|}
|
||||
opt opt_all flag required
|
||||
| _ -> failwith "keys: connect needs exactly 4 arguments"
|
||||
in
|
||||
let runtime_args = [ opt; opt_all; flag; required ] in
|
||||
impl ~connect ~runtime_args "Unit" job
|
||||
|
||||
let main = main ~runtime_args ~pos:__POS__ "App.Make" (job @-> job)
|
||||
let () = register "noop" [ main $ keys ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue