1717 following is a minimalist command that does nothing:
1818
1919 {[
20- let cmd : unit Command.t =
21- Command.make
22- ~summary:"A command that does nothing."
23- (let open Command.Std in
24- let+ () = Arg.return () in
25- ())
26- ;;
20+ let cmd : unit Command.t =
21+ Command.make
22+ ~summary:"A command that does nothing."
23+ (let open Command.Std in
24+ let+ () = Arg.return () in
25+ ())
26+ ;;
2727 ]}
2828
2929 To get started with this API refers to this
@@ -107,13 +107,13 @@ module Nonempty_list : sig
107107 [string Nonempty_list.t] and may be used that way:
108108
109109 {[
110- Arg.flag [ "verbose" ] ~doc:"Enable more output."
110+ Arg.flag [ "verbose" ] ~doc:"Enable more output."
111111 ]}
112112
113113 The point being that the following would be a type error:
114114
115115 {[
116- Arg.flag [] ~doc:"Enable more output."
116+ Arg.flag [] ~doc:"Enable more output."
117117 ]} *)
118118 type 'a t = 'a Cmdlang_ast.Ast.Nonempty_list .t = ( :: ) : 'a * 'a list -> 'a t
119119end
126126 build a parser for it with:
127127
128128 {[
129- Param.enumerated (module My_enum)
129+ Param.enumerated (module My_enum)
130130 ]} *)
131131
132132module type Enumerated_stringable = sig
@@ -141,7 +141,7 @@ module type Enumerated_stringable = sig
141141 to be able to define an equality function between [t]s defined as such:
142142
143143 {[
144- let equal a b = phys_equal a b || String.equal (to_string a) (to_string b)
144+ let equal a b = phys_equal a b || String.equal (to_string a) (to_string b)
145145 ]} *)
146146 val to_string : t -> string
147147end
@@ -234,22 +234,22 @@ module Param : sig
234234
235235 Example:
236236 {[
237- module Color = struct
238- type t =
239- | Red
240- | Green
241- | Blue
242-
243- let all = [ Red; Green; Blue ]
244-
245- let to_string = function
246- | Red -> "red"
247- | Green -> "green"
248- | Blue -> "blue"
249- ;;
250- end
237+ module Color = struct
238+ type t =
239+ | Red
240+ | Green
241+ | Blue
242+
243+ let all = [ Red; Green; Blue ]
244+
245+ let to_string = function
246+ | Red -> "red"
247+ | Green -> "green"
248+ | Blue -> "blue"
249+ ;;
250+ end
251251
252- let color_param = Param.enumerated ~docv:"COLOR" (module Color)
252+ let color_param = Param.enumerated ~docv:"COLOR" (module Color)
253253 ]}
254254
255255 The usage message will show the supported values for [COLOR]. *)
@@ -370,16 +370,16 @@ type 'a t
370370
371371 Example:
372372 {[
373- let hello_cmd =
374- Command.make
375- ~summary:"Prints [\"Hello, world!\"]."
376- ~readme:(fun () ->
377- "This would usually be a longer description of the command.\n\
378- It can be written on multiple lines.")
379- (let open Command.Std in
380- let+ () = Arg.return () in
381- print_endline "Hello, world!")
382- ;;
373+ let hello_cmd =
374+ Command.make
375+ ~summary:"Prints [\"Hello, world!\"]."
376+ ~readme:(fun () ->
377+ "This would usually be a longer description of the command.\n\
378+ It can be written on multiple lines.")
379+ (let open Command.Std in
380+ let+ () = Arg.return () in
381+ print_endline "Hello, world!")
382+ ;;
383383 ]} *)
384384val make : ?readme : (unit -> string ) -> 'a Arg .t -> summary :string -> 'a t
385385
@@ -394,11 +394,11 @@ val make : ?readme:(unit -> string) -> 'a Arg.t -> summary:string -> 'a t
394394
395395 Example of a group with no default command:
396396 {[
397- let cmd_group =
398- Command.group
399- ~summary:"A group of related commands."
400- [ "hello", hello_cmd; "goodbye", goodbye_cmd ]
401- ;;
397+ let cmd_group =
398+ Command.group
399+ ~summary:"A group of related commands."
400+ [ "hello", hello_cmd; "goodbye", goodbye_cmd ]
401+ ;;
402402 ]}
403403
404404 Each command in the group may itself be a group, allowing for hierarchical
@@ -445,13 +445,13 @@ end
445445 For use with the [( let+ )] style:
446446
447447 {[
448- let cmd : unit Command.t =
449- Command.make
450- ~summary:"A command that does nothing."
451- (let open Command.Std in
452- let+ () = Arg.return () in
453- ())
454- ;;
448+ let cmd : unit Command.t =
449+ Command.make
450+ ~summary:"A command that does nothing."
451+ (let open Command.Std in
452+ let+ () = Arg.return () in
453+ ())
454+ ;;
455455 ]} *)
456456
457457module Std : sig
@@ -466,12 +466,12 @@ end
466466 For use with the [( let%map_open.Command )] style:
467467
468468 {[
469- let cmd : unit Command.t =
470- Command.make
471- ~summary:"A command that does nothing."
472- (let%map_open.Command () = Arg.return () in
473- ())
474- ;;
469+ let cmd : unit Command.t =
470+ Command.make
471+ ~summary:"A command that does nothing."
472+ (let%map_open.Command () = Arg.return () in
473+ ())
474+ ;;
475475 ]} *)
476476
477477module Let_syntax : sig
0 commit comments