Skip to content

Commit 17ab65b

Browse files
committed
Rename desc argument to doc
This is to avoid confusion with the `description` field of manpages. Signed-off-by: Stephen Sherratt <[email protected]>
1 parent 64e642c commit 17ab65b

File tree

14 files changed

+195
-191
lines changed

14 files changed

+195
-191
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Changed
6+
7+
- Rename `desc` in APIs to `doc` to avoid confusion with the `description` field of manpages. (#12)
8+
39
## 0.4.0
410

511
### Added

examples/echo_ansi.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ let main ~bold ~underline ~color words =
4141

4242
let () =
4343
let command =
44-
Command.singleton ~desc:"Echo with style!"
44+
Command.singleton ~doc:"Echo with style!"
4545
@@
4646
let open Arg_parser in
47-
(* Describe and parse the command line arguments:*)
48-
let+ bold = flag [ "bold" ] ~desc:"Make the text bold"
49-
and+ underline = flag [ "underline" ] ~desc:"Underline the text"
50-
and+ color = named_opt [ "color" ] Color.conv ~desc:"Set the text color"
47+
(* Describe and parse the command line arguments: *)
48+
let+ bold = flag [ "bold" ] ~doc:"Make the text bold"
49+
and+ underline = flag [ "underline" ] ~doc:"Underline the text"
50+
and+ color = named_opt [ "color" ] Color.conv ~doc:"Set the text color"
5151
and+ words = pos_all string
5252
and+ completion =
53-
flag [ "completion" ] ~desc:"Print this program's completion script and exit"
53+
flag [ "completion" ] ~doc:"Print this program's completion script and exit"
5454
in
5555
if completion
5656
then `Completion
@@ -60,11 +60,11 @@ let () =
6060
that we should print the completion script. *)
6161
let help_style =
6262
let open Help_style in
63-
{ program_desc = { ansi_style_plain with color = Some `Green }
63+
{ program_doc = { ansi_style_plain with color = Some `Green }
6464
; usage = { ansi_style_plain with color = Some `Yellow }
6565
; section_heading = { ansi_style_plain with color = Some `Red }
6666
; arg_name = { ansi_style_plain with color = Some `Blue }
67-
; arg_desc = { ansi_style_plain with color = Some `Cyan }
67+
; arg_doc = { ansi_style_plain with color = Some `Cyan }
6868
}
6969
in
7070
match

examples/fake_git.ml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ let checkout =
2727

2828
let commit =
2929
let open Arg_parser in
30-
let+ _amend = flag [ "amend" ] ~desc:"Amend a commit"
31-
and+ _all = flag [ "a" ] ~desc:"Commit all changes"
30+
let+ _amend = flag [ "amend" ] ~doc:"Amend a commit"
31+
and+ _all = flag [ "a" ] ~doc:"Commit all changes"
3232
and+ _branch = named_opt [ "b"; "branch" ] branch_conv
3333
and+ _message =
3434
named_opt
3535
[ "m"; "message" ]
3636
string
37-
~desc:
37+
~doc:
3838
"The commit message. This description is extra long to exercise text wrapping in \
3939
help messages."
40-
and+ _files = pos_all file ~desc:"The files to commit" in
40+
and+ _files = pos_all file ~doc:"The files to commit" in
4141
()
4242
;;
4343

@@ -47,7 +47,7 @@ let log =
4747
named_opt
4848
[ "pretty"; "p" ]
4949
(string_enum [ "full"; "fuller"; "short"; "oneline" ])
50-
~desc:"foo"
50+
~doc:"foo"
5151
in
5252
()
5353
;;
@@ -65,18 +65,18 @@ let () =
6565
let open Command in
6666
group
6767
~prose:(Manpage.prose ~description:[] ())
68-
~desc:"Fake version control"
69-
[ subcommand "config" (singleton Arg_parser.unit ~desc:"Configure the tool.")
70-
; subcommand "checkout" (singleton checkout ~desc:"Check out a revision.")
71-
; subcommand "commit" (singleton commit ~desc:"Commit your changes.")
72-
; subcommand "log" (singleton log ~desc:"List recent commits.")
68+
~doc:"Fake version control"
69+
[ subcommand "config" (singleton Arg_parser.unit ~doc:"Configure the tool.")
70+
; subcommand "checkout" (singleton checkout ~doc:"Check out a revision.")
71+
; subcommand "commit" (singleton commit ~doc:"Commit your changes.")
72+
; subcommand "log" (singleton log ~doc:"List recent commits.")
7373
; subcommand
7474
"bisect"
7575
(group
7676
~default_arg_parser:bisect_common
77-
~desc:"Binary search through previous commits."
78-
[ subcommand "start" (singleton bisect_common ~desc:"Start a bisect.")
79-
; subcommand "reset" (singleton bisect_common ~desc:"Stop a bisect.")
77+
~doc:"Binary search through previous commits."
78+
[ subcommand "start" (singleton bisect_common ~doc:"Start a bisect.")
79+
; subcommand "reset" (singleton bisect_common ~doc:"Stop a bisect.")
8080
])
8181
; subcommand ~hidden:true "__internal" print_completion_script_bash
8282
]

examples/sum.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ open Climate
33

44
let main =
55
let open Arg_parser in
6-
let+ args = pos_all int ~desc:"The ints to be summed" in
6+
let+ args = pos_all int ~doc:"The ints to be summed" in
77
print_endline (Printf.sprintf "%d" (List.fold_left args ~init:0 ~f:( + )))
88
;;
99

examples/sum2.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ open Climate
22

33
let main =
44
let open Arg_parser in
5-
let+ a = pos_req 0 int ~value_name:"LHS" ~desc:"The left hand side of the operation"
6-
and+ b = pos_req 1 int ~value_name:"RHS" ~desc:"The right hand side of the operation" in
5+
let+ a = pos_req 0 int ~value_name:"LHS" ~doc:"The left hand side of the operation"
6+
and+ b = pos_req 1 int ~value_name:"RHS" ~doc:"The right hand side of the operation" in
77
print_endline (Printf.sprintf "%d" (a + b))
88
;;
99

0 commit comments

Comments
 (0)