package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_utils/Mopsa_utils/Core/ArgExt/index.html
Module Core.ArgExt
include module type of struct include Arg_complete end
Specification
Command line argument specifications are extended with completion functions.
Type for function providing multiple-argument completions (only in Rest_all).
type spec = Arg_complete.spec = | Unit of unit -> unit(*Call the function with unit argument
*)| Bool of bool -> unit(*Call the function with a bool argument
*)| Set of bool ref(*Set the reference to true
*)| Clear of bool ref(*Set the reference to false
*)| String of string -> unit * complete(*Call the function with a string argument
*)| Set_string of string ref * complete(*Set the reference to the string argument
*)| Int of int -> unit * complete(*Call the function with an int argument
*)| Set_int of int ref * complete(*Set the reference to the int argument
*)| Float of float -> unit * complete(*Call the function with a float argument
*)| Set_float of float ref * complete(*Set the reference to the float argument
*)| Tuple of spec list(*Take several arguments according to the spec list
*)| Symbol of string list * string -> unit(*Take one of the symbols as argument and call the function with the symbol
*)| Rest of string -> unit * complete(*Stop interpreting keywords and call the function with each remaining argument
*)| Rest_all of string list -> unit * complete_all(*Stop interpreting keywords and call the function with all remaining arguments
*)| Expand of string -> string array(*If the remaining arguments to process are of the form
*)["-foo"; "arg"] @ restwhere "foo" is registered asExpand f, then the argumentsf "arg" @ restare processed. Only allowed inStdlib.Arg.parse_and_expand_argv_dynamic.
Command line argument specification like Stdlib.Arg.spec, but extended with completion functions.
module Rest_all_compat = Arg_complete.Rest_all_compatCompatibility for Rest_all before OCaml 4.12
Parsing
The library does not provide parsing of command line arguments itself. Instead, the following functions can be used to strip completion functions from specifications, such that parsing functions from Stdlib.Arg can be used.
val arg_speclist : speclist -> arg_speclistStrip completion functions from speclist.
Completing
type anon_complete = completeval complete_argv :
?prefer_getopt_long:bool ->
string list ->
speclist ->
anon_complete ->
string listcomplete_argv args speclist anon_complete provides the completions for the partial arguments args using speclist for options and anon_complete for anonymous arguments.
Convenience
val empty : completeCompletion function with constant empty result.
val empty_all : complete_allCompletion function with constant empty result for Rest_all.
val strings : string list -> completeCompletion function for a list of possible strings.
module Util = Arg_complete.Utilval set_string_list_lifter : string list ref -> string -> unitval complete_files_in_dir : ?prefix:string -> string -> complete