E <+M&55.5.0+dev0-2025-04-28/#Arg$specA;@@$Unit@$unit6@@@{@@}7@@@|@@~@@4../../stdlib/arg.mliP  P @@#ArgA@$Bool@$bool8@@@@@!9@@@@@@@Q8:Q8R@@B@#Set&Stdlib;#ref:@@@@@@@@3R4R@@2C@%Clear&Stdlib=#ref5<@@@@@@@@KSLS@@JD@&String@&string>@@@@@j?@@@@@@@dTeT$@@cE@*Set_string&StdlibA#ref@@@@@@@@@|UUW}UUq@@{F@#Int@#intB@@@@@C@@@@@@@VV@@G@'Set_int&StdlibE#refD@@@@@@@@WW@@H@%Float@%floatF@@@@@G@@@@@@@X=?X=Y@@I@)Set_float&StdlibI#refH@@@@@@@@YY@@J@%Tuple$listK#ArgJ$spec@@@@@@@@ZZ@@K@&SymbolML@@@@@@@N@@@@@!O@@@@@@@\TV\T@@L@$Rest@P@@@@@9Q@@@@@@@3_4_0@@2M@(Rest_all @YSR@@@@@@@@WT@@@@@@@QaRa@@PN@&Expand!@U@@@@@%arrayWV@@@@@@@@@@pdhjqdh@@oO@@@A@@@@@tO  @@@@r@@A@#key"B;@@@A%X@@@0@@@@nn@@@@P@A@#doc#C;@@A4Y@@@8@@@@oo@@@@Q@A@)usage_msg$D;@@ACZ@@@@@@@@pp@@@@R@A@(anon_fun%E;@@.A@V[@@@H@@J\@@@I@@K@@@@qq @@@@S@A@%parse&@`@#Arg]#key@@@[@#Arg^$spec@@@\@#Arg_#doc@@@]@@^@@@`@@h@#Arga(anon_fun@@@a@@f@#Argb)usage_msg@@@b@@dc@@@c@@e@@g@@i@ s"" t.h@@T@@-parse_dynamic'@&Stdlibh#ref6g@#Argd#key@@@j@#Arge$spec@@@k@#Argf#doc@@@l@@m@@@o@@@q@@y@#Argi(anon_fun@@@r@@w@#Argj)usage_msg@@@s@@uhk@@@t@@v@@x@@z@bc@@aU@@*parse_argv('current&optionL&Stdlibm#refl@@@{@@@}@@@@@@&o6n@@@~@@@@@@s@#Argp#key@@@@#Argq$spec@@@@#Argr#doc@@@@@@@@@@@#Argt(anon_fun@@@@@@#Argu)usage_msg@@@@@v@@@@@@@@@@@@@@HH~@@V@@2parse_argv_dynamic)'currentz&Stdlibx#reflw@@@@@@@@@@@@zy@@@@@@@@@&Stdlib#ref0~@#Arg{#key@@@@#Arg|$spec@@@@#Arg}#doc@@@@@@@@@@@@@@#Arg(anon_fun@@@@@@@@@@@_@@@@@@@@@@@@@@YZ " ]@@XW@@=parse_and_expand_argv_dynamic*@&Stdlib#ref@@@@@@@@@&Stdlib#ref,@@@@@@@@@@@@&Stdlib#ref@#Arg#key@@@@#Arg$spec@@@@#Arg#doc@@@@@@@@@@@@@@#Arg(anon_fun@@@@@@v@@@@@@@@@@@@@@@@@@@! ! !P!@@X@@,parse_expand+@@#Arg#key@@@Р@#Arg$spec@@@Ѡ@#Arg#doc@@@@@@@@@@@#Arg(anon_fun@@@@@@#Arg)usage_msg@@@@@/@@@@@@@@@@)"Z"Z*"l"@@(Y@@±$Help,F##exnG@@@@@@A<#5#5=#5#M@@;Z@B@±#Bad-G#@@@@@@AL##M##@@K[@B@%usage.@q@#Arg#key@@@㠠@#Arg$spec@@@䠠@#Arg#doc@@@@@@@@@@@#Arg)usage_msg@@@@@@@@@@@@@$b$b$b$@@\@@,usage_string/@@#Arg#key@@@@#Arg$spec@@@@#Arg#doc@@@@@@@@@@@#Arg)usage_msg@@@@@v@@@@@@@@%%%%@@]@@%align0%limitr\@@@@@@ @@ @@#Arg#key@@@@#Arg$spec@@@@#Arg#doc@@@@@@@@ @@ .@#Arg#key@@@ @#Arg$spec@@@ @#Arg#doc@@@ @@ @@@ @@ @@ @<&Y&Y=&Y&@@;^@@'current1&Stdlib#ref@@@ @@@ @S((T((@@R_@@(read_arg2@@@@ @@ @@@ @@@ @@ @p))q)*@@o`@@)read_arg03@$@@@ @@ .@@@ @@@ @@ @*w*w*w*@@a@@)write_arg4@A@@@ @@ $@?O@@@ @@@ @@ "@@@ !@@ #@@ %@++++B@@b@@*write_arg05@g@@@ &@@ -@eu@@@ '@@@ )@@ +@@@ *@@ ,@@ .@,,,,E@@c@@@3 "Parsing of command line arguments.@ This module provides a general mechanism for extracting options and arguments from the command line to the program. For example:@!  let usage_msg = "append [-verbose] [] ... -o " let verbose = ref false let input_files = ref [] let output_file = ref "" let anon_fun filename = input_files := filename::!input_files let speclist = [("-verbose", Arg.Set verbose, "Output debug information"); ("-o", Arg.Set_string output_file, "Set output file name")] let () = Arg.parse speclist anon_fun usage_msg; (* Main functionality here *) @ Q Syntax of command lines: A keyword is a character string starting with a !- ^. An option is a keyword alone or followed by an argument. The types of keywords are: $Unit", $Bool", #Set", %Clear&, &String", *Set_string", #Int", 'Set_int", %Float", )Set_float&, %Tuple", &Symbol", $Rest", (Rest_all% and &Expand!.@% $Unit", #Set% and %Clear; keywords take no argument.@' A $Rest$ or (Rest_all ] keyword takes the remainder of the command line as arguments. (More explanations below.)@ Every other keyword takes the following word on the command line as argument. For compatibility with GNU getopt_long, +keyword=arg ] is also allowed. Arguments not preceded by a keyword are called anonymous arguments.@. Examples (#cmd $ is assumed to be the command name):" 4cmd -flag /(a unit option)@" 4cmd -int 1 =(an int option with argument !1!)@" 4cmd -string foobar ?(a string option with argument ("foobar"!)@" 4cmd -float 12.34 >(a float option with argument %12.34!)@" 4cmd a b c <(three anonymous arguments: #"a"", #"b"&, and #"c"!)@" 4cmd a b -- c d Y(two anonymous arguments and a rest option with two arguments)@@% $Rest Z takes a function that is called repeatedly for each remaining command line argument. (Rest_all T takes a function that is called once, with the list of all remaining arguments.@ ( Note that if no arguments follow a $Rest O keyword then the function is not called at all whereas the function for a (Rest_all * keyword is called with an empty list.@@@@@@@@@@@5unsynchronized_access nThe Arg module relies on a mutable global state, parsing functions should only be called from a single domain.@A4../../stdlib/arg.mli#(Arg.spec3 GThe concrete type describing the behavior associated with a keyword.@@@@@@@@@@@@@32@@3 $Call the function with unit argument@@@@@@@@@@@@"!@@3 &Call the function with a bool argument@@@@@@@@@@@@@@39Set the reference to true@@@@@@@@@@@@@@3:Set the reference to false@@@@@@@@@@@@@@3 (Call the function with a string argument@@@@@@@@@@@@葠@@3 (Set the reference to the string argument@@@@@@@@@@@@ڑ@@3 &Call the function with an int argument@@@@@@@@@@@@ˑ@@3 %Set the reference to the int argument@@@@@@@@@@@@@@3 'Call the function with a float argument@@@@@@@@@@@@@@3 'Set the reference to the float argument@@@@@@@@@@@@@@3 TTake several arguments according to the spec list@@@@@@@@@@@@@@3 lTake one of the symbols as argument and call the function with the symbol@@@@@@@@@@@@xw@@3 pStop interpreting keywords and call the function with each remaining argument@@@@@@@@@@@@ji@@3 pStop interpreting keywords and call the function with all remaining arguments@@@@@@@@@@@@VU@@3 If the remaining arguments to process are of the form 6["-foo"; "arg"] @ rest I where "foo" is registered as (Expand f @, then the arguments .f "arg" @ rest v are processed. Only allowed in =parse_and_expand_argv_dynamic!.@@@@@@@@@@@@@A@@\_@@#'Arg.key@@@AY@VU@@#'Arg.doc@@@AS@PO@@#-Arg.usage_msg@@@AM@JI@@#,Arg.anon_fun@@@AG@;:@@)Arg.parse3 %Arg.parse speclist anon_fun usage_msg> parses the command line. (speclist6 is a list of triples 0(key, spec, doc)&. #key - is the option keyword, it must start with a #'-'0 character. $spec g gives the option type and the function to call when this option is found on the command line. #doc / is a one-line description of this option. (anon_fun 8 is called on anonymous arguments. The functions in $spec% and (anon_fun P are called in the same order as their arguments appear on the command line.@9 If an error occurs, )Arg.parse U exits the program, after printing to standard error an error message as follows: M The reason for the error: unknown option, invalid or missing argument, etc.@" )usage_msg@ : The list of options, each followed by the corresponding #doc 0 string. Beware: options that have an empty #doc - string will not be included in the list.@@ P For the user to be able to specify anonymous arguments starting with a !-6, include for example ;("-", String anon_fun, doc)$ in (speclist!.@1 By default, %parse> recognizes two unit options, %-help% and &--help *, which will print to standard output )usage_msg p and the list of options, and exit the program. You can override this behaviour by specifying your own %-help% and &--help, options in (speclist!.@@@@@@@@@@@@@ @@@@@@1Arg.parse_dynamic3(Same as D@2, except that the (speclist argument is a reference and may be updated during the parsing. A typical use for this feature is to parse command lines of the form:7 command subcommand 'options O where the list of options depends on the value of the subcommand argument.@@@@@@$4.01@@@@@@@@0@3@6@@@@{.Arg.parse_argv3 8Arg.parse_argv ~current args speclist anon_fun usage_msg4 parses the array $args E as if it were the command line. It uses and updates the value of (~current0 (if given), or +Arg.currentD@ $. You must set it before calling *parse_argv8. The initial value of 'current U is the index of the program name (argument 0) in the array. If an error occurs, .Arg.parse_argv( raises 'Arg.BadG@ 2 with the error message as argument. If option %-help$ or &--help- is given, .Arg.parse_argv( raises (Arg.HelpG@ % with the help message as argument.@@@@@@@@@@@@@@@@z@q@@@@d6Arg.parse_argv_dynamic3(Same as lD@2, except that the (speclist L argument is a reference and may be updated during the parsing. See D@!.@@@@$4.01@@@@@@@y@yx@e@Y@)@ @@@@ !Arg.parse_and_expand_argv_dynamic3(Same as 8D@2, except that the $argv F argument is a reference and may be updated during the parsing of &Expand4 arguments. See JD@!.@@@@$4.05@@@@@@@1@2@#@@@@@@@ˠ0Arg.parse_expand3(Same as D@2, except that the &Expand # arguments are allowed and the ĐD@: reference is not updated.@@@@$4.05@@@@@@@@ @#@&@@@@3*Raised by .Arg.parse_argv= when the user asks for help.@@@@@@@@@@@@@@@@@@Ӑ3-Functions in $spec$ or (anon_fun+ can raise 'Arg.Bad < with an error message to reject invalid arguments. 'Arg.Bad3 is also raised by $D@5 in case of an error.@@@@@@@@@@@@@@@@@@)Arg.usage3 prints in case of error. (speclist% and )usage_msg5 are the same as for 6D@!.@@@@@@@@@@@@@@@@@@0Arg.usage_string3 4Returns the message that would have been printed by 6D@ +, if provided with the same parameters.@@@@@@@@@@@@@@@@@@~)Arg.align3 >Align the documentation strings by inserting spaces at the first alignment separator (tab or, if tab is not found, space), according to the length of the keyword. Use a alignment separator as the first character in a doc string if you want to align the whole string. The doc strings corresponding to &Symbol ( arguments are aligned on the next line.@@@@@@@%limit -options with keyword and message longer than %limit / will not be used to compute the alignment.@@@@@@@   @@@@@>3-Position (in (Sys.argv@@ Q) of the argument being processed. You can change this value, e.g. to force D@= to skip some arguments. D@; uses the initial value of D@ h as the index of argument 0 (the program name) and starts parsing arguments at the next element.@@@@@@@@@@@@V@@@@J,Arg.read_arg31Arg.read_arg file ? reads newline-terminated command line arguments from file $file!.@@@@$4.05@@@@@@@V@W@@@@G-Arg.read_arg03-Identical to #D@ B but assumes null character terminated command line arguments.@@@@$4.05@@@@@@@P@'Q@@@@A-Arg.write_arg37Arg.write_arg file args6 writes the arguments $args & newline-terminated into the file $file=. If any of the arguments in $args= contains a newline, use .Arg.write_arg0D@) instead.@@@@$4.05@@@@@@@`@Ta@W[@@@@K3-Identical to 8D@ C but uses the null character for terminator instead of newline.@@@@$4.05@@@@@@@S@mT@pN@@@@>@@ @@A@@@@@