From 99f0e4e2a14189686e58d91e594a21d3f2442b7c Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Wed, 9 Oct 2019 17:16:41 +0200 Subject: [PATCH] Don't generate --no-option for single char option names --- ocamlformat-help.txt | 2 +- src/Config_option.ml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ocamlformat-help.txt b/ocamlformat-help.txt index 330660d578..50dde032b7 100644 --- a/ocamlformat-help.txt +++ b/ocamlformat-help.txt @@ -525,7 +525,7 @@ OPTIONS --no-comment-check Unset comment-check. - --no-quiet, --no-q + --no-quiet Unset quiet. --no-version-check diff --git a/src/Config_option.ml b/src/Config_option.ml index 3a8c138e43..c3565df4c4 100644 --- a/src/Config_option.ml +++ b/src/Config_option.ml @@ -85,7 +85,10 @@ module Make (C : CONFIG) = struct ?(allow_inline = Poly.(section = `Formatting)) ?(deprecated = false) update get_value = let open Cmdliner in - let invert_names = List.map names ~f:(fun n -> "no-" ^ n) in + let invert_names = + List.filter_map names ~f:(fun n -> + if String.length n = 1 then None else Some ("no-" ^ n)) + in let doc = generated_flag_doc ~allow_inline ~doc ~section ~default ~deprecated in