[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,13 +447,14 @@ 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
ignore if not (String.is_empty long) then
(mk ~long:nolong ?short:noshort ~deprecated:deprecated_no ~default:(not default) ?parse_mode ignore
?in_help ~meta nodoc ~default_to_string (mk ~long:nolong ?short:noshort ~deprecated:deprecated_no ~default:(not default) ?parse_mode
~mk_setter:(fun _ _ -> var := f false) ?in_help ~meta nodoc ~default_to_string
~decode_json:(fun ~inferconfig_dir:_ json -> ~mk_setter:(fun _ _ -> var := f false)
[dashdash (if YBU.to_bool json then nolong else long)] ) ~decode_json:(fun ~inferconfig_dir:_ json ->
~mk_spec) ; [dashdash (if YBU.to_bool json then nolong else long)] )
~mk_spec) ;
var var

Loading…
Cancel
Save