From df58a37cb9e273a4b51d942d278940ebdb10dba3 Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Thu, 21 Sep 2023 17:58:34 +0200 Subject: [PATCH] Option to suppress global switches in subcmd help --- src/clic-subcommand-instance.adb | 4 +++- src/clic-subcommand-instance.ads | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/clic-subcommand-instance.adb b/src/clic-subcommand-instance.adb index 6646c2b..5b0bcd7 100644 --- a/src/clic-subcommand-instance.adb +++ b/src/clic-subcommand-instance.adb @@ -444,7 +444,9 @@ package body CLIC.Subcommand.Instance is Display_Options (Config, "OPTIONS"); - Display_Global_Options; + if Global_Options_In_subcommand_help then + Display_Global_Options; + end if; -- Format and print the long command description Put_Line (""); diff --git a/src/clic-subcommand-instance.ads b/src/clic-subcommand-instance.ads index 1bf03cc..1c559d9 100644 --- a/src/clic-subcommand-instance.ads +++ b/src/clic-subcommand-instance.ads @@ -28,6 +28,10 @@ generic with function TTY_Underline (Str : String) return String; with function TTY_Emph (Str : String) return String; + Global_Options_In_subcommand_help : Boolean := True; + -- When listing help for a subcommand, also include a section on global + -- options (that apply to all subcommands). + package CLIC.Subcommand.Instance is procedure Register (Cmd : not null Command_Access);