Module Cmdliner_base
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))
val
uid : ``unit
->
int
uid ()
is new unique for the program run.
val
suggest : ``string
->
``string list``
->
``string list
suggest near candidates
suggest values from candidates
not too far
from near
.
Formatting helpers
val
pp_text :
Stdlib.Format.formatter
->
``string
->
unit
val
pp_lines :
Stdlib.Format.formatter
->
``string
->
unit
val
pp_tokens : ``spaces:bool
->
Stdlib.Format.formatter
->
``string
->
unit
Error message helpers
val
quote : ``string
->
string
val
alts_str : ``?quoted:bool
->
``string list``
->
string
val
err_ambiguous : ``kind:string
->
``string
->
``ambs:``string list``
->
string
val
err_unknown : ``?dom:``string list``
->
``?hints:``string list``
->
``kind:string
->
``string
->
string
val
err_multi_def : ``kind:string
->
``string
->
``(
'b
->
string)``
->
'b
->
'b
->
string
Textual OCaml value converters
type
``'a parser`` = ``string
->
``[ ```
Ok of ````'a
``` |
Error ``` of string ```` ]`
type
``'a printer`` =
Stdlib.Format.formatter
->
'a
->
unit
val
bool : ``bool
conv
val
char : ``char
conv
val
int : ``int
conv
val
nativeint : ``nativeint
conv
val
int32 : ``int32
conv
val
int64 : ``int64
conv
val
float : ``float
conv
val
string : ``string
conv
val
enum : ``(string *
'a
)`` list``
->
'a
conv
val
file : ``string
conv
val
dir : ``string
conv
val
non_dir_file : ``string
conv
val
env_bool_parse : ``bool
parser