Arg.Completion
Argument completion.
This modules provides a type to describe how argument values described by argument converters can be completed. They define which completion directives from the protocol get emitted by cmdliner for the argument.
The type for completion functions. Given a prefix should return a list of possible completions and a doc string.
make ()
is a completion specification with given properties. See accesors for semantics. Note that the properties are not mutually exclusive.
val dirs : 'a t -> bool
dirs c
indicates the argument should be completed with directories.
val files : 'a t -> bool
files c
indicates the argument should be completed with files.
val restart : 'a t -> bool
restart c
indicates that shell should restart the completion after the positional disambiguation token --
.
This is typically used for tools that end-up invoking other tools like sudo -- TOOL [ARG]…
. For the latter a restart completion should be added on all positional arguments. If you allow TOOL
to be only a restricted set of tools known to your program you'd eschew restart
on the first postional argument but add it to the remaining ones.
Warning. Other completion properties are ignored when you use this. Also note that restart
directives are emitted only after a --
token and it's likely that it will work with completion scripts only if the TOOL
is specified after the token. Educate your users to use the --
(e.g. mention them in user user defined synopses) it's good cli sepcication hygiene anyways.