@@ -189,8 +189,8 @@ impl<'help, 'cmd, 'writer> Help<'help, 'cmd, 'writer> {
189189 }
190190
191191 /// Sorts arguments by length and display order and write their help to the wrapped stream.
192- fn write_args ( & mut self , args : & [ & Arg < ' help > ] ) -> io:: Result < ( ) > {
193- debug ! ( "Help::write_args" ) ;
192+ fn write_args ( & mut self , args : & [ & Arg < ' help > ] , _category : & str ) -> io:: Result < ( ) > {
193+ debug ! ( "Help::write_args {}" , _category ) ;
194194 // The shortest an arg can legally be is 2 (i.e. '-x')
195195 let mut longest = 2 ;
196196 let mut ord_v = Vec :: new ( ) ;
@@ -203,9 +203,12 @@ impl<'help, 'cmd, 'writer> Help<'help, 'cmd, 'writer> {
203203 should_show_arg ( self . use_long , * arg)
204204 } ) {
205205 if arg. longest_filter ( ) {
206- debug ! ( "Help::write_args: Current Longest...{}" , longest) ;
207206 longest = longest. max ( display_width ( arg. to_string ( ) . as_str ( ) ) ) ;
208- debug ! ( "Help::write_args: New Longest...{}" , longest) ;
207+ debug ! (
208+ "Help::write_args: arg={:?} longest={}" ,
209+ arg. get_id( ) ,
210+ longest
211+ ) ;
209212 }
210213
211214 // Formatting key like this to ensure that:
@@ -854,7 +857,7 @@ impl<'help, 'cmd, 'writer> Help<'help, 'cmd, 'writer> {
854857 self . none ( "\n \n " ) ?;
855858 }
856859 self . warning ( "OPTIONS:\n " ) ?;
857- self . write_args ( & non_pos) ?;
860+ self . write_args ( & non_pos, "OPTIONS" ) ?;
858861 first = false ;
859862 }
860863 if !custom_headings. is_empty ( ) {
@@ -876,7 +879,7 @@ impl<'help, 'cmd, 'writer> Help<'help, 'cmd, 'writer> {
876879 self . none ( "\n \n " ) ?;
877880 }
878881 self . warning ( format ! ( "{}:\n " , heading) ) ?;
879- self . write_args ( & args) ?;
882+ self . write_args ( & args, heading ) ?;
880883 first = false
881884 }
882885 }
@@ -1079,10 +1082,10 @@ impl<'help, 'cmd, 'writer> Help<'help, 'cmd, 'writer> {
10791082 "options" => {
10801083 // Include even those with a heading as we don't have a good way of
10811084 // handling help_heading in the template.
1082- self . write_args( & self . cmd. get_non_positionals( ) . collect:: <Vec <_>>( ) ) ?;
1085+ self . write_args( & self . cmd. get_non_positionals( ) . collect:: <Vec <_>>( ) , "options" ) ?;
10831086 }
10841087 "positionals" => {
1085- self . write_args( & self . cmd. get_positionals( ) . collect:: <Vec <_>>( ) ) ?;
1088+ self . write_args( & self . cmd. get_positionals( ) . collect:: <Vec <_>>( ) , "positionals" ) ?;
10861089 }
10871090 "subcommands" => {
10881091 self . write_subcommands( self . cmd) ?;
0 commit comments