66import sys
77import textwrap
88from collections import defaultdict
9+ from dataclasses import dataclass
910from typing import Dict , List , Optional
1011
1112from rich import box
@@ -311,23 +312,20 @@ def _help_group_arguments(
311312 # Parent arguments are grouped in with their children
312313 arg_path = arg_path [:- 1 ]
313314
314- print (arg .path , arg .is_parent , arg_path )
315315 # Find first common parent
316316 while len (arg_path ) > 1 and arg_path not in paths :
317317 arg_path = arg_path [:- 1 ]
318318
319- print (arg .path , arg .is_parent , arg_path )
320319 path_to_args [arg_path ].append (arg )
321320
322321 group_required = []
323322 groups = []
324323 ungrouped = []
325324
326325 for k , group in sorted (
327- path_to_args .items (), key = lambda a : (a [0 ], len (a [1 ]))
326+ path_to_args .items (), key = lambda a : (len ( a [ 0 ]), a [0 ], len (a [1 ]))
328327 ):
329- # If the group has more than one element,
330- # leave it as is in the result
328+
331329 if len (group ) > 1 :
332330 groups .append (
333331 # Args should be ordered by least depth -> required -> path
@@ -340,6 +338,7 @@ def _help_group_arguments(
340338 # If the group's argument is required,
341339 # add it to the required group
342340 if target_arg .required :
341+ print (target_arg )
343342 group_required .append (target_arg )
344343 continue
345344
0 commit comments