Module Cmdliner.Manpage
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::cmdlinerlibrary to any desired targets insrc/*/CMakeLists.txt:target_link_libraries(YourPackage_YourLibraryName # ... existing libraries, if any ... Findlib::cmdliner)Click your IDE's
Buildbutton
Not using DkSDK?
FIRST, do one or all of the following:
Run:
opam install cmdliner.1.1.1+duneEdit your
dune-projectand add:(package (name YourExistingPackage) (depends ; ... existing dependenices ... (cmdliner (>= 1.1.1+dune))))Then run:
dune build *.opam # if this fails, run: dune buildEdit your
<package>.opamfile 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))Man pages
typeblock`` = ``[
| ```S ``ofstring
| ```P ``ofstring
| ```Pre ``ofstring
| ```I ``ofstring * string
| ```Noblank ``
| ```Blocks ``ofblocklist]
The type for a block of man page text.
`S sintroduces a new sections, see the standard section names.`P tis a new paragraph with textt.`Pre tis a new preformatted paragraph with textt.`I (l,t)is an indented paragraph with labelland textt.`Noblanksuppresses the blank line introduced between two blocks.`Blocks bssplices the blocksbs.
Except in `Pre, whitespace and newlines are not significant and
are all collapsed to a single space. All block strings support the
documentation markup language.
valescape : ``string->string
escape s escapes s so that it doesn't get interpreted by the
documentation markup language.
typetitle`` = string * int * string * string * string
The type for man page titles. Describes the man page title, section,
center_footer, left_footer, center_header.
typexref`` = ``[
| ```Main ``
| ```Cmd ``ofstring
| ```Tool ``ofstring
| ```Page ``ofstring * int]
The type for man page cross-references.
`Mainrefers to the man page of the program itself.`Cmd cmdrefers to the man page of the program'scmdcommand (which must exist).`Tool binrefers to the command line tool namedbin.`Page (name, sec)refers to the man pagename(sec).
Standard section names and content
The following are standard man page section names, roughly ordered in
the order they conventionally appear. See also
man man-pages
for more elaborations about what sections should contain.
vals_name : string
The NAME section. This section is automatically created by Cmdliner
for your.
vals_synopsis : string
The SYNOPSIS section. By default this section is automatically created
by Cmdliner for you, unless it is the first section of your term's man
page, in which case it will replace it with yours.
vals_description : string
The DESCRIPTION section. This should be a description of what the tool
does and provide a little bit of usage and documentation guidance.
vals_commands : string
The COMMANDS section. By default subcommands get listed here.
vals_arguments : string
The ARGUMENTS section. By default positional arguments get listed
here.
vals_options : string
The OPTIONS section. By default optional arguments get listed here.
vals_common_options : string
The COMMON OPTIONS section. By default help and version options get
listed here. For programs with multiple commands, optional arguments
common to all commands can be added here.
vals_exit_status : string
The EXIT STATUS section. By default term status exit codes get listed
here.
vals_environment : string
The ENVIRONMENT section. By default environment variables get listed
here.
vals_environment_intro :block
s_environment_intro is the introduction content used by cmdliner when
it creates the s_environment section.
vals_files : string
The FILES section.
vals_bugs : string
The BUGS section.
vals_examples : string
The EXAMPLES section.
The AUTHORS section.
vals_see_also : string
The SEE ALSO section.
vals_none : string
s_none is a special section named "cmdliner-none" that can be used
whenever you do not want something to be listed.
Output
The print function can be useful if the client wants to
define other man pages (e.g. to implement a help command).
typeformat`` = ``[
| ```Auto ``
| ```Pager ``
| ```Plain ``
| ```Groff ``]
The type for man page output specification.
`Auto, formats like`Pageror`Plainwhenever theTERMenvironment variable isdumbor unset.`Pager, tries to write to a discovered pager, if that fails uses the`Plainformat.`Plain, formats to plain text.`Groff, formats to groff commands.
valprint : ``?errs:Stdlib.Format.formatter->``?subst:``(``string->``string option``)``->format->Stdlib.Format.formatter->t->unit
print ~errs ~subst fmt ppf page prints page on ppf in the format
fmt. subst can be used to perform variable substitution,(defaults to
the identity). errs is used to print formatting errors, it defaults to
Format.err_formatter.
