Command-Line Interface

The command-line interface is defined using cmdliner. One thing to note is that we use binding operators to compose terms:

bin/print_rules.ml
174let+ builder = Common.Builder.term
175and+ out =
176  Arg.(
177    value
178    & opt (some string) None
179    & info [ "o" ] ~docv:"FILE" ~doc:"Output to a file instead of stdout.")
180and+ recursive =
181  Arg.(
182    value
183    & flag
184    & info
185        [ "r"; "recursive" ]
186        ~doc:
187          "Print all rules needed to build the transitive dependencies of the given \
188           targets.")
189and+ syntax = Syntax.term
190and+ targets = Arg.(value & pos_all dep [] & Arg.info [] ~docv:"TARGET") in