Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
droideck committed Jan 23, 2025
1 parent 733d6a3 commit d133907
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib389/lib389/cli_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,16 @@ class CustomHelpFormatter(argparse.HelpFormatter):
description to the full help output
"""
def add_arguments(self, actions):
if len(actions) > 0 and actions[0].option_strings:
actions = parent_arguments + actions
if len(actions) > 0:
# Check if we're in the main options section (not in any group)
# Actions in the main section don't have a container with a title
is_main_section = not hasattr(actions[0], 'container') or \
not hasattr(actions[0].container, 'title')

# Only add parent arguments to the main options section
if is_main_section:
actions = parent_arguments + actions

super(CustomHelpFormatter, self).add_arguments(actions)

def _format_usage(self, usage, actions, groups, prefix):
Expand Down

0 comments on commit d133907

Please sign in to comment.