Recommendations to create a CLI tool

I asked a similar question recently at Parsing one's own command line (at least for one of the bricks you envision). Some answers there may help. Actually, Cmdliner can parse not only the command line, but any string array: see the documentation for the argument argv in

val eval : ?help:Stdlib.Format.formatter -> ?err:Stdlib.Format.formatter ->
 ?catch:bool -> ?env:(string -> string option) -> ?argv:string array ->
 ?term_err:Exit.code -> unit t -> Exit.code

I’d recommend to read some code of similar projects, and I’d like to do so myself, but I haven’t found many. I looked at the way the interface of utop was coded, to get some inspiration.