From 4778e6940131e97691f5e1e3d04a28480a9066cc Mon Sep 17 00:00:00 2001 From: Lakelezz <12222135+Lakelezz@users.noreply.github.com> Date: Fri, 14 Sep 2018 17:07:51 +0200 Subject: Check if a group is empty and exclude them if that's the case. (#389) --- src/framework/standard/help_commands.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/framework') diff --git a/src/framework/standard/help_commands.rs b/src/framework/standard/help_commands.rs index 4953b21..ca8fdc6 100644 --- a/src/framework/standard/help_commands.rs +++ b/src/framework/standard/help_commands.rs @@ -489,7 +489,9 @@ fn create_command_group_commands_pair_from_groups<'a, H: BuildHasher>( &help_options, ); - listed_groups.push(group_with_cmds); + if !group_with_cmds.command_names.is_empty() { + listed_groups.push(group_with_cmds); + } } listed_groups @@ -553,10 +555,12 @@ pub fn create_customised_help_data<'a, H: BuildHasher>( &help_options ); - return CustomisedHelpData::GroupedCommands { - help_description: group.description.clone().unwrap_or_default(), - groups: vec![single_group], - }; + if !single_group.command_names.is_empty() { + return CustomisedHelpData::GroupedCommands { + help_description: group.description.clone().unwrap_or_default(), + groups: vec![single_group], + }; + } } } -- cgit v1.2.3