Module Cmdliner_arg

Contents

Instructions: Use this module in your project

In the IDE (CLion, Visual Studio Code, Xcode, etc.) you use for your DkSDK project:

  1. Add the following to your project's dependencies/CMakeLists.txt:

    Copy
    DkSDKProject_DeclareAvailable(cmdliner
        CONSTRAINT "= 1.1.1+dune"
        FINDLIBS cmdliner)
    DkSDKProject_MakeAvailable(cmdliner)
  2. Add the Findlib::cmdliner library to any desired targets in src/*/CMakeLists.txt:

    Copy
    target_link_libraries(YourPackage_YourLibraryName
         # ... existing libraries, if any ...
         Findlib::cmdliner)
  3. Click your IDE's Build button

Not using DkSDK?

FIRST, do one or all of the following:

  1. Run:

    Copy
    opam install cmdliner.1.1.1+dune
  2. Edit your dune-project and add:

    Copy
    (package
      (name YourExistingPackage)
      (depends
      ; ... existing dependenices ...
      (cmdliner (>= 1.1.1+dune))))

    Then run:

    Copy
    dune build *.opam # if this fails, run: dune build
  3. Edit your <package>.opam file and add:

    Copy
    depends: [
      # ... existing dependencies ...
      "cmdliner" {>= "1.1.1+dune"}
    ]

    Then run:

    Copy
    opam install . --deps-only

FINALLY, add the cmdliner library to any desired (library)and/or (executable) targets in your **/dune files:

Copy
(library
  (name YourLibrary)
  ; ... existing library options ...
  (libraries
    ; ... existing libraries ...
    cmdliner))

(executable
  (name YourExecutable)
  ; ... existing executable options ...
  (libraries
    ; ... existing libraries ...
    cmdliner))
type``'a parser`` = ``string->``[ ```Ok of  ````'a``` |Error ``` of string ```` ]`
type``'a printer`` =Stdlib.Format.formatter -> 'a -> unit
type``'a conv`` ='a parser*'a printer
type``'a converter`` ='a conv
valconv : ``?docv:string->``(``(``string-> ``('a, ``[ ``` Msg of string ``` ]) [result](../../ocaml/Stdlib/#type-result))``  * `'a printer) `` \`->`` ``'a`` ``conv`
valconv' : ``?docv:string->``(``(``string-> ``('a, string)`` result)`` * 'a printer)`` -> 'a conv
valpconv : ``?docv:string-> ``('a parser*'a printer)`` -> 'a conv
valconv_parser :'a conv ->``string-> ``('a, ``[ ``` Msg of string ``` ]) [result`](../../ocaml/Stdlib/#type-result)
valconv_printer :'a conv -> 'a printer
valconv_docv :'a conv -> string
valparser_of_kind_of_string : ``kind:string->``(``string-> 'aoption``)``->``string-> ``('a, ``[ ``` Msg of string ``` ]) [result`](../../ocaml/Stdlib/#type-result)
valsome : ``?none:string-> 'a converter -> 'aoption``converter
val some' : ``?none:'a -> 'a converter -> 'aoption``converter
valenv_var : ``?deprecated:string->``?docs:string->``?doc:string->``string-> env
type``'a t`` ='a Cmdliner_term.t
type info
valinfo : ``?deprecated:string->``?absent:string->``?docs:string->``?docv:string->``?doc:string-> ``?env:env ->``string list``-> info
val (&) : ``('a -> 'b)`` -> 'a -> 'b
valflag :info ->``boolt
valflag_all :info ->``bool list``t
valvflag :'a -> ``('a*info)`` list`` -> 'a t
valvflag_all :'alist``-> ``('a*info)`` list`` -> 'alist``t
val opt : ``?vopt:'a -> 'a converter -> 'a -> info -> 'a t
val opt_all : ``?vopt:'a -> 'a converter -> 'alist``-> info -> 'alist``t
valpos : ``?rev:bool->``int-> 'a converter -> 'a -> info -> 'a t
valpos_all :'a converter -> 'alist``-> info -> 'alist``t
valpos_left : ``?rev:bool->``int-> 'a converter -> 'alist``-> info -> 'alist``t
valpos_right : ``?rev:bool->``int-> 'a converter -> 'alist``-> info -> 'alist``t

As terms

valvalue :'a t -> 'a Cmdliner_term.t
valrequired :'aoption``t -> 'a Cmdliner_term.t
valnon_empty :'alist``t -> 'alist``Cmdliner_term.t
vallast :'alist``t -> 'a Cmdliner_term.t

Predefined arguments

valstdopt_version : ``docs:string->``boolCmdliner_term.t
valstdopt_help : ``docs:string-> Cmdliner_manpage.formatoption``Cmdliner_term.t

Converters

valbool : ``boolconverter
valchar : ``charconverter
valint : ``intconverter
valnativeint : ``nativeintconverter
valint32 : ``int32converter
valint64 : ``int64converter
valfloat : ``floatconverter
valstring : ``stringconverter
valenum : ``(string *'a)`` list`` -> 'a converter
valfile : ``stringconverter
valdir : ``stringconverter
valnon_dir_file : ``stringconverter
vallist : ``?sep:char-> 'a converter -> 'alist``converter
valarray : ``?sep:char-> 'a converter -> 'aarray``converter
valpair : ``?sep:char-> 'a converter -> 'b converter -> ``('a*'b)`` converter
valt2 : ``?sep:char-> 'a converter -> 'b converter -> ``('a*'b)`` converter
valt3 : ``?sep:char-> 'a converter -> 'b converter -> 'c converter -> ``('a*'b*'c)`` converter
valt4 : ``?sep:char-> 'a converter -> 'b converter -> 'c converter -> 'd converter -> ``('a*'b*'c*'d)`` converter
valdoc_quote : ``string-> string
valdoc_alts : ``?quoted:bool->``string list``-> string
valdoc_alts_enum : ``?quoted:bool->``(string *'a)`` list`` -> string