Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file command_shape_intf.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239(** A [Command_shape] allows limited introspection of a [Command], including subcommands,
arguments, and doc strings. Think of it as machine-readable help. *)open!Importopen!Std_internalmoduletypeCommand_shape=sigmoduleAnons:sigmoduleGrammar:sigtypet=|Zero|Oneofstring|Manyoft|Maybeoft|Concatoftlist|Ad_hocofstring[@@derivingbin_shape,compare,sexp_of]includeInvariant.Swithtypet:=tvalusage:t->stringendtypet=|Usageofstring(** When exec'ing an older binary whose help sexp doesn't expose the grammar. *)|GrammarofGrammar.t[@@derivingbin_shape,compare,sexp_of]endmoduleNum_occurrences:sigtypet={at_least_once:bool;at_most_once:bool}[@@derivingcompare,enumerate,fields,sexp_of]valto_help_string:t->flag_name:string->stringendmoduleFlag_info:sigtypet={name:string(** See [flag_name] below. *);doc:string;aliases:stringlist}[@@derivingcompare,fields,sexp_of](** [flag_name] infers the string which one would pass on the command line. It is not
the same as the raw [name] field, which additionally encodes [num_occurrences] and
[requires_arg] (sort of). *)valflag_name:t->stringOr_error.tvalnum_occurrences:t->Num_occurrences.tOr_error.t(** [requires_arg] gives undefined behavior on [escape] flags. This is a limitation of
the underlying shape representation. *)valrequires_arg:t->boolOr_error.tincludeBinable.Swithtypet:=t[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Flag_info]."]valt_of_sexp:Sexp.t->t[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Flag_info]."]endmoduleFlag_help_display:sigtypet=Flag_info.tlistvalsort:t->tvalto_string:t->stringendmoduleBase_info:sigtypet={summary:string;readme:stringoption;anons:Anons.t;flags:Flag_info.tlist}[@@derivingcompare,fields,sexp_of](** [find_flag t prefix] looks up the flag, if any, to which [prefix] refers.
It raises if [prefix] does not begin with [-] as all flags should.
[find_flag] does not consider [aliases_excluded_from_help], and it assumes that
all flags can be passed by prefix. These are limitations in the underlying shape
representation. *)valfind_flag:t->string->Flag_info.tOr_error.tvalget_usage:t->stringincludeBinable.Swithtypet:=t[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Base_info]."]valt_of_sexp:Sexp.t->t[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Base_info]."]endmoduleGroup_info:sigtype'at={summary:string;readme:stringoption;subcommands:(string,'a)List.Assoc.tLazy.t}[@@derivingcompare,fields,sexp_of]valfind_subcommand:'at->string->'aOr_error.tvalmap:'at->f:('a->'b)->'btincludeBinable.S1withtype'at:='at[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Group_info]."]valt_of_sexp:(Sexp.t->'a)->Sexp.t->'at[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Group_info]."]endmoduleExec_info:sigtypet={summary:string;readme:stringoption;working_dir:string;path_to_exe:string;child_subcommand:stringlist}[@@derivingcompare,fields,sexp_of]includeBinable.Swithtypet:=t[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Exec_info]."]valt_of_sexp:Sexp.t->t[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Exec_info]."]end(** Fully forced shapes are comparable and serializable. *)moduleFully_forced:sigtypet=|BasicofBase_info.t|GroupoftGroup_info.t|ExecofExec_info.t*t[@@derivingcompare,sexp_of]valexpanded_subcommands:t->stringlistlistincludeBinable.Swithtypet:=t[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Fully_forced]."]valt_of_sexp:Sexp.t->t[@@deprecated"[since 2020-04] Use [Command.Stable.Shape.Fully_forced]."]endtypet=|BasicofBase_info.t|GroupoftGroup_info.t|ExecofExec_info.t*(unit->t)|LazyoftLazy.tvalfully_forced:t->Fully_forced.tvalget_summary:t->stringmoduleSexpable:sigtypet=|BaseofBase_info.t|GroupoftGroup_info.t|ExecofExec_info.t|LazyoftLazy.t[@@derivingsexp_of]valextraction_var:stringvalsupported_versions:Set.M(Int).tmoduleVersioned:sigtypet[@@derivingsexp]endvalof_versioned:Versioned.t->tvalto_versioned:t->version_to_use:int->Versioned.tendvalhelp_text:[`Use_Command_unix][@@deprecated"[since 2021-03] Use [Command_unix]"]moduleStable:sigmoduleAnons:sigmoduleGrammar:sigmoduleV1:Stable_without_comparatorwithtypet=Anons.Grammar.tendmoduleV2:Stable_without_comparatorwithtypet=Anons.tendmoduleFlag_info:sigmoduleV1:Stable_without_comparatorwithtypet=Flag_info.tendmoduleBase_info:sigmoduleV2:Stable_without_comparatorwithtypet=Base_info.tendmoduleGroup_info:sigmoduleV2:Stable1withtype'at='aGroup_info.tendmoduleExec_info:sigmoduleV3:Stable_without_comparatorwithtypet=Exec_info.tendmoduleFully_forced:sigmoduleV1:Stable_without_comparatorwithtypet=Fully_forced.tendendmodulePrivate:sigmoduleKey_type:sigtypet=|Subcommand|Flagvalto_string:t->stringendvalabs_path:dir:string->string->stringvalhelp_screen_compare:string->string->intvallookup_expand:(string*('a*[`Full_match_required|`Prefix]))list->string->Key_type.t->(string*'a,string)resultvalword_wrap:string->int->stringlistendend