Skip to content

Commit 13f34ff

Browse files
authored
chore: force cmdliner doc argument to be explicit (#12728)
Signed-off-by: Ali Caglayan <[email protected]>
1 parent c29185b commit 13f34ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+409
-252
lines changed

bin/arg.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
open Stdune
22
include Cmdliner.Arg
33

4+
let info ?deprecated ?absent ?docs ?docv ~doc ?env names =
5+
Cmdliner.Arg.info ?deprecated ?absent ?docs ?docv ?doc ?env names
6+
;;
7+
48
include struct
59
open Dune_lang
610
module Stanza = Stanza

bin/arg.mli

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
open Stdune
22

33
include module type of struct
4-
include Cmdliner.Arg
5-
end
4+
include Cmdliner.Arg
5+
end
6+
with type info := Cmdliner.Arg.info
7+
8+
val info
9+
: ?deprecated:string
10+
-> ?absent:string
11+
-> ?docs:string
12+
-> ?docv:string
13+
-> doc:string option
14+
-> ?env:Cmdliner.Cmd.Env.info
15+
-> string list
16+
-> Cmdliner.Arg.info
617

718
module Path : sig
819
module External : sig

bin/build.ml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ let build =
162162
]
163163
]
164164
in
165-
let name_ = Arg.info [] ~docv:"TARGET" in
165+
(* CR-someday Alizter: document this option *)
166+
let name_ = Arg.info [] ~docv:"TARGET" ~doc:None in
166167
let term =
167168
let+ builder = Common.Builder.term
168169
and+ targets = Arg.(value & pos_all dep [] name_)
@@ -174,10 +175,11 @@ let build =
174175
[ "alias-rec" ]
175176
~docv:"ALIAS"
176177
~doc:
177-
"Build the alias $(docv) in its parent directory and all subdirectories. \
178-
Equivalent to the build target $(b,@)$(docv). Example: $(b,--alias-rec \
179-
dir/foo) builds the $(b,foo) alias in $(b,dir/) and all its \
180-
subdirectories. Repeatable.")
178+
(Some
179+
"Build the alias $(docv) in its parent directory and all \
180+
subdirectories. Equivalent to the build target $(b,@)$(docv). Example: \
181+
$(b,--alias-rec dir/foo) builds the $(b,foo) alias in $(b,dir/) and \
182+
all its subdirectories. Repeatable."))
181183
and+ aliases =
182184
Arg.(
183185
value
@@ -186,9 +188,10 @@ let build =
186188
[ "alias" ]
187189
~docv:"ALIAS"
188190
~doc:
189-
"Build $(docv) in its parent directory only. Equivalent to the build \
190-
target $(b,@@)$(docv). Example: $(b,--alias dir/foo) builds the $(b,foo) \
191-
alias in $(b,dir/) only. Repeatable.")
191+
(Some
192+
"Build $(docv) in its parent directory only. Equivalent to the build \
193+
target $(b,@@)$(docv). Example: $(b,--alias dir/foo) builds the \
194+
$(b,foo) alias in $(b,dir/) only. Repeatable."))
192195
in
193196
let targets = List.concat [ targets; aliases; aliases_rec ] in
194197
let targets =

bin/cache.ml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let trim =
2828
& info
2929
~docv:"BYTES"
3030
[ "trimmed-size" ]
31-
~doc:"Size to trim from the cache. $(docv) is the same as for --size.")
31+
~doc:(Some "Size to trim from the cache. $(docv) is the same as for --size."))
3232
and+ size =
3333
Arg.(
3434
value
@@ -37,13 +37,14 @@ let trim =
3737
~docv:"BYTES"
3838
[ "size" ]
3939
~doc:
40-
(sprintf
41-
"Size to trim the cache to. $(docv) is the number of bytes followed by \
42-
a unit. Byte units can be one of %s."
43-
(String.enumerate_or
44-
(List.map
45-
~f:(fun (units, _) -> List.hd units)
46-
Bytes_unit.conversion_table))))
40+
(Some
41+
(sprintf
42+
"Size to trim the cache to. $(docv) is the number of bytes followed \
43+
by a unit. Byte units can be one of %s."
44+
(String.enumerate_or
45+
(List.map
46+
~f:(fun (units, _) -> List.hd units)
47+
Bytes_unit.conversion_table)))))
4748
in
4849
Log.init_disabled ();
4950
let open Result.O in
@@ -84,7 +85,9 @@ let size =
8485
Arg.(
8586
value
8687
& flag
87-
& info [ "machine-readable" ] ~doc:"Outputs size as a plain number of bytes.")
88+
& info
89+
[ "machine-readable" ]
90+
~doc:(Some "Outputs size as a plain number of bytes."))
8891
in
8992
let size = Dune_cache.Trimmer.overhead_size () in
9093
if machine_readable

0 commit comments

Comments
 (0)