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:
Add the following to your project's
dependencies/CMakeLists.txt
:DkSDKProject_DeclareAvailable(cmdliner CONSTRAINT "= 1.1.1+dune" FINDLIBS cmdliner) DkSDKProject_MakeAvailable(cmdliner)
Add the
Findlib::cmdliner
library to any desired targets insrc/*/CMakeLists.txt
:target_link_libraries(YourPackage_YourLibraryName # ... existing libraries, if any ... Findlib::cmdliner)
Click your IDE's
Build
button
Not using DkSDK?
FIRST, do one or all of the following:
Run:
opam install cmdliner.1.1.1+dune
Edit your
dune-project
and add:(package (name YourExistingPackage) (depends ; ... existing dependenices ... (cmdliner (>= 1.1.1+dune))))
Then run:
dune build *.opam # if this fails, run: dune build
Edit your
<package>.opam
file and add:depends: [ # ... existing dependencies ... "cmdliner" {>= "1.1.1+dune"} ]
Then run:
opam install . --deps-only
FINALLY, add the cmdliner
library to any desired (library)
and/or (executable)
targets in your **/dune
files:
(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 converter`` =
'a
conv
val
conv_parser :
'a
conv
->
``string
->
``(
'a
, ``[ ```
Msg of string ``` ])
[
result`](../../ocaml/Stdlib/#type-result)
val
conv_docv :
'a
conv
->
string
val
parser_of_kind_of_string : ``kind:string
->
``(``string
->
'a
option``)``
->
``string
->
``(
'a
, ``[ ```
Msg of string ``` ])
[
result`](../../ocaml/Stdlib/#type-result)
type
env`` =
Cmdliner_info.Env.info
val
env_var : ``?deprecated:string
->
``?docs:string
->
``?doc:string
->
``string
->
env
type
``'a t`` =
'a
Cmdliner_term.t
type
info
val
(&) : ``(
'a
->
'b
)``
->
'a
->
'b
As terms
val
value :
'a
t
->
'a
Cmdliner_term.t
val
required :
'a
option``
t
->
'a
Cmdliner_term.t
val
non_empty :
'a
list``
t
->
'a
list``
Cmdliner_term.t
val
last :
'a
list``
t
->
'a
Cmdliner_term.t
Predefined arguments
val
man_format :
Cmdliner_manpage.format
Cmdliner_term.t
val
stdopt_version : ``docs:string
->
``bool
Cmdliner_term.t
val
stdopt_help : ``docs:string
->
Cmdliner_manpage.format
option``
Cmdliner_term.t
Converters
val
bool : ``bool
converter
val
char : ``char
converter
val
int : ``int
converter
val
nativeint : ``nativeint
converter
val
int32 : ``int32
converter
val
int64 : ``int64
converter
val
float : ``float
converter
val
string : ``string
converter
val
enum : ``(string *
'a
)`` list``
->
'a
converter
val
file : ``string
converter
val
dir : ``string
converter
val
non_dir_file : ``string
converter
val
doc_quote : ``string
->
string
val
doc_alts : ``?quoted:bool
->
``string list``
->
string
val
doc_alts_enum : ``?quoted:bool
->
``(string *
'a
)`` list``
->
string