@@ -157,75 +157,92 @@ def parse(self, argument_string):
157157 # Return new Arguments with converted options
158158 return Arguments (arguments .expressions , arguments .flags , converted_options )
159159
160- def help_text (self , command_name ):
160+ def help_text (self , command_name , terminal ):
161161 """Generate help text from usage specification.
162162
163163 Args:
164- command_name: Name of the command (e.g., "rb-object-print")
164+ command_name: Name of the command (e.g., "rb-print")
165+ terminal: Terminal for colored output
165166
166167 Returns:
167168 Formatted help string with usage, parameters, options, and flags
168169 """
169- lines = [self .summary , "" ]
170+ import format as fmt
171+
172+ # Summary with color
173+ lines = [terminal .print (fmt .bold , self .summary , fmt .reset ), "" ]
170174
171175 # Build usage line
172- usage_parts = [command_name ]
176+ usage_parts = [terminal .print (fmt .bold , command_name , fmt .reset )]
177+
173178 for param_name , _ in self .parameters :
174- usage_parts .append (f"<{ param_name } >" )
179+ usage_parts .append (terminal . print ( fmt . placeholder , f"<{ param_name } >" , fmt . reset ) )
175180
176181 # Add option placeholders
177182 for option_name in self .options .keys ():
178- usage_parts .append (f"[--{ option_name } N]" )
183+ opt_placeholder = f"[--{ option_name } N]"
184+ usage_parts .append (terminal .print (fmt .placeholder , opt_placeholder , fmt .reset ))
179185
180186 # Add flag placeholders
181187 for flag_name , _ in self .flags :
182- usage_parts .append (f"[--{ flag_name } ]" )
188+ flag_placeholder = f"[--{ flag_name } ]"
189+ usage_parts .append (terminal .print (fmt .placeholder , flag_placeholder , fmt .reset ))
183190
184191 lines .append (f"Usage: { ' ' .join (usage_parts )} " )
185192 lines .append ("" )
186193
187194 # Parameter descriptions
188195 if self .parameters :
189- lines .append ("Parameters:" )
196+ lines .append (terminal .print (fmt .title , "Parameters:" , fmt .reset ))
197+
190198 for param_name , param_desc in self .parameters :
199+ param_str = terminal .print (fmt .symbol , param_name , fmt .reset )
191200 if param_desc :
192- lines .append (f" { param_name :<15} { param_desc } " )
201+ lines .append (f" { param_str :<15} { param_desc } " )
193202 else :
194- lines .append (f" { param_name } " )
203+ lines .append (f" { param_str } " )
195204 lines .append ("" )
196205
197206 # Option descriptions
198207 if self .options :
199- lines .append ("Options:" )
208+ lines .append (terminal .print (fmt .title , "Options:" , fmt .reset ))
209+
200210 for option_name , opt_spec in self .options .items ():
201211 opt_type , opt_default = opt_spec [0 ], opt_spec [1 ]
202212 opt_desc = opt_spec [2 ] if len (opt_spec ) > 2 else None
203213
204214 type_str = opt_type .__name__ if hasattr (opt_type , '__name__' ) else str (opt_type )
205215 default_str = f" (default: { opt_default } )" if opt_default is not None else ""
206216
217+ opt_str = terminal .print (fmt .symbol , f"--{ option_name } " , fmt .reset )
218+ type_part = terminal .print (fmt .placeholder , f" <{ type_str } >" , fmt .reset )
219+
207220 if opt_desc :
208- lines .append (f" -- { option_name } < { type_str } > { default_str } " )
221+ lines .append (f" { opt_str } { type_part } { default_str } " )
209222 lines .append (f" { opt_desc } " )
210223 else :
211- lines .append (f" -- { option_name } < { type_str } > { default_str } " )
224+ lines .append (f" { opt_str } { type_part } { default_str } " )
212225 lines .append ("" )
213226
214227 # Flag descriptions
215228 if self .flags :
216- lines .append ("Flags:" )
229+ lines .append (terminal .print (fmt .title , "Flags:" , fmt .reset ))
230+
217231 for flag_name , flag_desc in self .flags :
232+ flag_str = terminal .print (fmt .symbol , f"--{ flag_name } " , fmt .reset )
218233 if flag_desc :
219- lines .append (f" -- { flag_name :<15} { flag_desc } " )
234+ lines .append (f" { flag_str :<15} { flag_desc } " )
220235 else :
221- lines .append (f" -- { flag_name } " )
236+ lines .append (f" { flag_str } " )
222237 lines .append ("" )
223238
224239 # Examples section
225240 if self .examples :
226- lines .append ("Examples:" )
241+ lines .append (terminal .print (fmt .title , "Examples:" , fmt .reset ))
242+
227243 for example_cmd , example_desc in self .examples :
228- lines .append (f" { example_cmd } " )
244+ cmd_str = terminal .print (fmt .placeholder , f" { example_cmd } " , fmt .reset )
245+ lines .append (cmd_str )
229246 if example_desc :
230247 lines .append (f" { example_desc } " )
231248 lines .append ("" )
0 commit comments