
    k7iq                          S r SSKJrJrJrJr  SSKJr  SSKJ	r	  \(       a   SSK
JrJrJr  SSKJr  SSKJr  SSKJrJrJr  \" S	S
9 " S S5      5       rg)z"Default Rich-based help formatter.    )TYPE_CHECKINGAnyOptionalUnion)define)SILENT)ConsoleConsoleOptionsRenderableType)	HelpPanel)ColumnSpecBuilder)
ColumnSpec	PanelSpec	TableSpecT)kw_onlyc                       \ rS rSr% SrSr\S   \S'    Sr\S   \S'    Sr	\
\S   S	4   S-  \S
'    \S 5       rSS jrSSSSS\SS4S jrSSSSS\SS4S jrSS jrSrg)DefaultFormatter   uK  Default help formatter using Rich library with customizable specs.

Parameters
----------
panel_spec : Optional[PanelSpec]
    Panel specification for the outer box/panel styling.
table_spec : Optional[TableSpec]
    Table specification for table styling (borders, padding, etc).
column_specs : Optional[Union[tuple[ColumnSpec, ...], ColumnSpecBuilder]]
    Column specifications or builder function for table columns.

Notes
-----
The relationship between these specs can be visualized as:

::

    ╭─ Commands ───────────────────────────────────────────────────────╮  ← panel_spec
    │ serve     Start the development server                           │     (border, title)
    │ --help    Display this message and exit.                         │
    ╰──────────────────────────────────────────────────────────────────╯
     ↑         ↑
     col[0]    col[1]
     (name)    (description)

    ╭─ Parameters ─────────────────────────────────────────────────────╮  ← panel_spec
    │ *  PORT --port        Server port number [required]              │
    │    VERBOSE --verbose  Enable verbose output [default: False]     │
    ╰──────────────────────────────────────────────────────────────────╯
     ↑  ↑                  ↑
     │  col[1]             col[2]
     │  (name/flags)       (description)
     │
     col[0]
     (required marker)

Where:

- ``panel_spec`` controls the outer panel appearance (border, title, etc.)
- ``table_spec`` controls the inner table styling (no visible borders by default)
- ``column_specs`` defines individual columns (width, style, alignment, etc.)
Nr   
panel_specr   
table_spec)r   .r   column_specsc                     S nU " SSU0UD6$ )aI  Create formatter with metadata on separate lines.

Returns a DefaultFormatter configured to display parameter metadata
(choices, env vars, defaults) on separate indented lines rather
than inline with descriptions.

Parameters
----------
**kwargs
    Additional keyword arguments to pass to DefaultFormatter constructor.

Returns
-------
DefaultFormatter
    Configured formatter instance with newline metadata display.

Examples
--------
>>> from cyclopts import App
>>> from cyclopts.help import DefaultFormatter
>>> app = App(help_formatter=DefaultFormatter.with_newline_metadata())
c                     SS K nSSKJnJnJnJn  UR                  U R                  S-  5      nU" U" US9SSUS9n	U" U" SS	9S
SS9n
[        S U 5       5      (       a  XIU
4$ X4$ )Nr   )AsteriskColumnr   DescriptionRendererNameRenderergffffff?)	max_widthOptioncyan)rendererheaderstyler   T)newline_metadataDescriptionfold)r    r!   overflowc              3   8   #    U  H  oR                   v   M     g 7f)N)required).0xs     Z/home/james-whalen/.local/lib/python3.13/site-packages/cyclopts/help/formatters/default.py	<genexpr>QDefaultFormatter.with_newline_metadata.<locals>.column_builder.<locals>.<genexpr>v   s     /w!::ws   )	mathcyclopts.help.specsr   r   r   r   ceilwidthany)consoleoptionsentriesr.   r   r   r   r   r   name_columndescription_columns              r+   column_builder>DefaultFormatter.with_newline_metadata.<locals>.column_builder`   s      		'--$"67I$%	:#	K ",,dCMdj" /w///&5GHH44    r    r;   )clskwargsr8   s      r+   with_newline_metadata&DefaultFormatter.with_newline_metadataG   s    2	54 99&99r:   r3   r	   r4   r
   returnc                 J    U R                  X1U5      nUR                  U5        g)zFormat and render a single help panel using Rich.

Parameters
----------
console : ~rich.console.Console
    Console to render to.
options : ~rich.console.ConsoleOptions
    Console rendering options.
panel : HelpPanel
    Help panel to render.
N)_render_panelprint)selfr3   r4   panelrendereds        r+   __call__DefaultFormatter.__call__|   s"     %%eg>hr:   usagec                 6    U(       a  UR                  U5        gg)zRender the usage line.

Parameters
----------
console : ~rich.console.Console
    Console to render to.
options : ~rich.console.ConsoleOptions
    Console rendering options.
usage : Any
    The usage line (Text or str).
NrC   )rD   r3   r4   rI   s       r+   render_usageDefaultFormatter.render_usage   s     MM%  r:   descriptionc                 6    U(       a  UR                  U5        gg)zRender the description.

Parameters
----------
console : ~rich.console.Console
    Console to render to.
options : ~rich.console.ConsoleOptions
    Console rendering options.
description : Any
    The description (can be various Rich renderables).
NrK   )rD   r3   r4   rN   s       r+   render_description#DefaultFormatter.render_description   s     MM+& r:   c                    UR                   (       d  [        $ SSKJn  SSKJn  SSKJn  SSKJnJ	nJ
n	Jn
  UR                  n[        X5      (       a&  SUl        UR                  (       a  U" X" S5      5      nU R                   =(       d    U" 5       nU R"                  =(       d    U" 5       nU R$                  nUc  UR&                  S:X  a  U	nOU
n[)        U5      (       a  U" X#UR                   5      nUR+                  XR                   5      nUc   eUR,                  c"  UR+                  U" X5      UR,                  S	9nU$ UR+                  U" X5      5      nU$ )
zRender a single help panel.r   )Group)NewLine)Text)r   r   get_default_command_columnsget_default_parameter_columns    command)title)r5   r   rich.consolerS   rT   	rich.textrU   r/   r   r   rV   rW   rN   
isinstanceendplainr   r   r   formatcallablebuildr[   )rD   
help_panelr3   r4   	RichGrouprT   rU   r   r   rV   rW   panel_descriptionr   r   columnstablerE   s                    r+   rB   DefaultFormatter._render_panel   sB   !!M3("	
 	
 '22'..$&! &&$-.?$L! __3	
__3	
 ##?  I-57Gg
0B0BCG   *<*<= !,,,#$$Y/@%HPZP`P`$aE  $$Y/@%HIEr:   r;   )r3   r	   r4   r
   rE   r   r@   N)rd   r   r3   r	   r4   r
   r@   r   )__name__
__module____qualname____firstlineno____doc__r   r   __annotations__r   r   r   tupleclassmethodr>   rG   r   rL   rP   rB   __static_attributes__r;   r:   r+   r   r      s    )V )-J%,\(,J%,[PTL%/02EEFMTe2: 2:h !I !8H !QT !Y] !') '>N ']` 'ei '2r:   r   N)rn   typingr   r   r   r   attrsr   cyclopts.help.silentr   r\   r	   r
   r   cyclopts.helpr   cyclopts.help.protocolsr   r/   r   r   r   r   r;   r:   r+   <module>rx      sJ    ( 6 6  'DD'9DD I I Ir:   