started command line interface

This commit is contained in:
Stavros Polymenis 2016-11-19 22:59:45 +00:00
parent 102a0288ca
commit 4472e8ae8a
2 changed files with 34 additions and 4 deletions

View File

@ -1,12 +1,18 @@
OCB_FLAGS = -use-ocamlfind -I src # -I lib
OCB = ocamlbuild $(OCB_FLAGS)
PKGS = toml,uuidm,opium.unix,omd,str,batteries,tyxml,lens,ptime,ptime.clock.os,re.str,lens.ppx_deriving,mustache
PKGS = toml,uuidm,omd,str,batteries,lens,ptime,ptime.clock.os,re.str,lens.ppx_deriving
WEB_PKGS = $(PKGS),opium.unix,tyxml,mustache
CMD_PKGS = $(PKGS),cmdliner
all: web
all: cmd web
web:
$(OCB) web.native -pkgs $(PKGS)
mv web.native web
$(OCB) web.native -pkgs $(WEB_PKGS)
mv web.native logarion-web
cmd:
$(OCB) command.native -pkg $(CMD_PKGS)
mv command.native logarion
style:
sassc share/sass/main.sass > share/static/main.css

24
src/command.ml Normal file
View File

@ -0,0 +1,24 @@
open Cmdliner
let info =
let doc = "Command based interface for a Logarion." in
let man = [
`S "BUGS";
`P "Submit bugs https://github.com/orbifx/logarion/issues.";
] in
Term.info "logarion" ~version:"0.1.0" ~doc ~man
let operation =
let doc = "Logarion operation" in
Arg.(value & pos 0 string "help" & info [] ~docv:"operation" ~doc)
let logarion operation =
match operation with
| "create" -> print_endline "create"
| _ -> print_endline "help"
let logarion_term =
Term.(const logarion $ operation)
let () =
match Term.eval (logarion_term, info) with
`Error _ -> exit 1 | _ -> exit 0