[clopt] do not generate "--no-" flag for [mk_bool ~long:""]

Summary:
Some options are deprecated and this is indicated with `~long:""`. But for
boolean options this creates a spurious `"--no-"` flag. Detect when the option
has an empty flag and don't create the "no" version in that case.

Reviewed By: ngorogiannis

Differential Revision: D20286830

fbshipit-source-id: 9a2095ea8
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent f5ab894675
commit e4602ba0df

@ -447,6 +447,7 @@ let mk_bool ?(deprecated_no = []) ?(default = false) ?(f = fun b -> b) ?(depreca
[dashdash (if YBU.to_bool json then long else nolong)] ) [dashdash (if YBU.to_bool json then long else nolong)] )
~mk_spec ~mk_spec
in in
if not (String.is_empty long) then
ignore ignore
(mk ~long:nolong ?short:noshort ~deprecated:deprecated_no ~default:(not default) ?parse_mode (mk ~long:nolong ?short:noshort ~deprecated:deprecated_no ~default:(not default) ?parse_mode
?in_help ~meta nodoc ~default_to_string ?in_help ~meta nodoc ~default_to_string

Loading…
Cancel
Save