123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566(**************************************************************************)(* *)(* Copyright 2020 OCamlPro & Origin Labs *)(* *)(* All rights reserved. This file is distributed under the terms of the *)(* GNU Lesser General Public License version 2.1, with the special *)(* exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)openEzcmd.V2openEZCMD.TYPESletcmd_name="run"letaction~args~cmd~package=if!Globals.verbosity=1thendecrGlobals.verbosity;(* By default, `drom run` should be quiet *)letp=Build.build~args()inletcmd=matchpackagewith|Somepackage->package::cmd|None->(matchp.package.kindwith|Library->cmd|Program->p.package.name::cmd|Virtual->cmd)inMisc.before_hook"run"~args:cmd;Misc.call(Array.of_list("opam"::"exec"::"--"::"dune"::"exec"::"--"::cmd))letcmd=letcmd=ref[]inletpackage=refNoneinletargs,specs=Build.build_args()inEZCMD.subcmd_name(fun()->action~args~cmd:!cmd~package:!package)~args:([(["p"],Arg.String(funs->package:=Somes),EZCMD.info~docv:"PACKAGE""Package to run");([],Arg.Anons(funlist->cmd:=list),EZCMD.info"Arguments to the command")]@specs)~doc:"Execute the project"~man:[`S"DESCRIPTION";`Blocks[`P"This command performs the following actions:";`I("1.","Decrease verbosity level to display nothing during build");`I("2.","Build the project packages (see $(b,drom build) for info).");`I("3.","Call $(b,opam exec -- drun exec -- [PACKAGE] [ARGUMENTS]), \
where $(b,[PACKAGE]) is either the package name specified \
with the $(b,-p PACKAGE) argument or the main package of the \
project if it is a program, $(b,[ARGUMENTS]) are the \
arguments specified with $(b,drom run)")]]