I’m trying to wrap my head around cmdliner and can’t seem to figure out how to make it work for my problem.
I want to support syntax of this kind
my_program FILE command -options
This means that
FILE is required, but passed to
command which can be several different commands (all of them work on the file).
Currently I have this for parsing the file:
let file_t = Arg.(required & pos 0 (some non_dir_file) None & info  ~docv:"FILE")
But I can’t figure out how to combine it with another command and pass the result of
file_t to the command.
Probably my problem can even be reworded further into - I can’t figure out how to pass the results of cmdliner to my functions… And how to call my functions at all. I even suspect that I’m not supposed to do that, but instead use
Term.eval, but I don’t get why, so some crash course into the philosophy of cmdliner would be great. I can’t seem to be able to figure out why I need all of this complexity at all.