Skip to content

Commit

Permalink
Option to suppress global switches in subcmd help
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 21, 2023
1 parent 6879b90 commit a6bea52
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/clic-subcommand-instance.adb
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ package body CLIC.Subcommand.Instance is
-- Display_Usage --
-------------------

procedure Display_Usage (Cmd : not null Command_Access) is
procedure Display_Usage (Cmd : not null Command_Access)
is
Config : Switches_Configuration;
Canary1 : Switches_Configuration;
Canary2 : Switches_Configuration;
Expand Down Expand Up @@ -444,7 +445,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 ("");
Expand Down
6 changes: 6 additions & 0 deletions src/clic-subcommand-instance.ads
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -84,6 +88,8 @@ package CLIC.Subcommand.Instance is
procedure Display_Usage (Displayed_Error : Boolean := False);

procedure Display_Help (Keyword : String);
-- Print help about a subcommand or topic. If Global_Option, list global
-- switches in addition to switches specific to the Keyword subcommand.

Error_No_Command : exception;
Command_Already_Defined : exception;
Expand Down

0 comments on commit a6bea52

Please sign in to comment.