
    k7i #                         S r SSKrSSKrSSKJrJr  \(       a  SSKJrJr  SSK	J
r
Jr  S\SSS	\4S
 jr " S S5      rg)z5Plain text help formatter for improved accessibility.    N)TYPE_CHECKINGAny)ConsoleConsoleOptions)	HelpEntry	HelpPanelobjconsoler   returnc                    U c  g[        U S5      (       a  U R                  R                  5       $ [        U S5      (       a  SSKJn  U" [
        R                  " 5       UR                  UR                  UR                  UR                  UR                  SSSSSS	9nUR                  5        nUR                  U SS
9  SSS5        WR                  5       R                  5       $ [        U 5      R                  5       $ ! , (       d  f       NE= f)zExtract plain text from Rich renderables.

Parameters
----------
obj : Any
    Object to convert to plain text.
console : ~rich.console.Console
    Console for rendering Rich objects.

Returns
-------
str
    Plain text representation.
N plain__rich_console__r   )r   FT)filewidthheighttab_sizelegacy_windowssafe_boxforce_terminalno_color	highlightmarkupemoji)end)hasattrr   rstriprich.consoler   ioStringIOr   r   r   r   r   captureprintgetstr)r	   r
   r   plain_consoler!   s        X/home/james-whalen/.local/lib/python3.13/site-packages/cyclopts/help/formatters/plain.py_to_plain_textr'      s     { sGyy!! s&''(-->>%%"11%% 
 ""$, %{{}##%% s8?? %$s   ,C<<
D
c                      \ rS rSrSr  SS\S\S-  4S jjrSSS	\S
S4S j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4   S\\S4   S\SSSSS
S4S jrS\\S4   S\\S4   S\SSS
S4
S jrSrg)PlainFormatter>   zPlain text formatter for improved accessibility.

Parameters
----------
indent_width : int
    Number of spaces to indent entries (default: 2).
max_width : Optional[int]
    Maximum line width for wrapping text.
Nindent_width	max_widthc                 0    Xl         X l        SU-  U l        g )N )r+   r,   indent)selfr+   r,   s      r&   __init__PlainFormatter.__init__I   s    
 )"L(    r
   r   textr   c                 &    UR                  USSS9  g)z.Print text without any highlighting or markup.F)r   r   N)r"   )r0   r
   r4   s      r&   _print_plainPlainFormatter._print_plainR   s    deE:r3   optionsr   c                    UR                   (       d  gUR                  (       a  U R                  XR                   S35        UR                    H  nUR                  (       a  SR	                  UR                  5      OSnUR
                  (       a  SR	                  UR
                  5      OSn[        UR                  U5      nU(       d	  U(       d  M  UR                  S:X  a*  U R                  UR                  UR
                  XqU5        M  U R                  UR                  UR
                  Xq5        M     UR                  5         g)zFormat and render a single help panel as plain text.

Parameters
----------
console : ~rich.console.Console
    Console to render to.
options : ~rich.console.ConsoleOptions
    Console rendering options.
panel : HelpPanel
    Help panel to render.
N:r.   r   	parameter)entriestitler6   namesjoinshortsr'   descriptionformat_format_parameter_entry_format_command_entryr"   )r0   r
   r8   panelentry
names_textshorts_textdescs           r&   __call__PlainFormatter.__call__V   s    " }} ;;g++a'89 ]]E 38++%++.2J49LL#((5<<0bK!%"3"3W=D [[<<;.00ellD[`a ..u{{ELL$X #" 	r3   usagec                 |    U(       a5  [        X15      nU(       a"  U R                  X5        UR                  5         g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r'   r6   r"   )r0   r
   r8   rL   
usage_texts        r&   render_usagePlainFormatter.render_usage   s5    " '7J!!'6  r3   rA   c                 |    U(       a5  [        X15      nU(       a"  U R                  X5        UR                  5         g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).
NrN   )r0   r
   r8   rA   	desc_texts        r&   render_description!PlainFormatter.render_description   s5    " &{<I!!'5  r3   r>   .r@   rI   rF   r   c                    [        U5      [        U5      -   nU(       d  g/ nU(       a  UR                  U5        UR                  (       a0  SR                  UR                  5      nUR                  SU S35        UR                  (       a0  SR                  UR                  5      n	UR                  SU	 S35        UR
                  b  UR                  SUR
                   S35        UR                  (       a  UR                  S5        SR                  U5      n
[        U5      S	:  aS  SR                  U5      nU
(       a  U S
U
 3nOUnU R                  U[        R                  " XR                  5      5        gU
(       a  US    S
U
 3nOUS   nU R                  U[        R                  " XR                  5      5        g)aG  Format and print a parameter entry.

Parameters
----------
names : tuple[str, ...]
    Parameter long names.
shorts : tuple[str, ...]
    Short forms of the parameter.
desc : str
    Parameter description.
console : ~rich.console.Console
    Console to print to.
entry : HelpEntry
    The full help entry with metadata fields.
N, z
[choices: ]z
[env var: z
[default: z
[required]r.      : r   )listappendchoicesr?   env_vardefaultrequiredlenr6   textwrapr/   )r0   r>   r@   rI   r
   rF   all_options
desc_partschoices_strenv_vars_str	full_descoptions_strr4   s                r&   rC   &PlainFormatter._format_parameter_entry   sp   0 5kDL0 
d# ==))EMM2K
;-q9:==99U]]3L
<.:;==$
5==/;<>>l+HHZ(	 {a))K0K%b4"gxt[['IJ %a.)I;7"1~gxt[['IJr3   c                 ^   U(       a  [        U5       H  u  pVUS:X  a  U/nU(       a#  UR                  SSR                  U5      -   5        SR                  U5      nU(       a  U SU 3n	OUn	U R                  U[        R
                  " XR
                  5      5        M  U R                  U[        R
                  " X`R
                  5      5        M     gU(       aS  SR                  U5      n
U(       a  U
 SU 3n	OU
n	U R                  U[        R
                  " XR
                  5      5        gg)zFormat and print a command entry.

Parameters
----------
names : tuple[str, ...]
    Command long names.
shorts : tuple[str, ...]
    Short forms of the command.
desc : str
    Command description.
console : ~rich.console.Console
    Console to print to.
r   rW   r.   r   rZ   N)	enumerater\   r?   r6   rb   r/   )r0   r>   r@   rI   r
   inameparts
entry_namer4   
shorts_strs              r&   rD   $PlainFormatter._format_command_entry   s    , $U+6!FETCHHV,<%<=!#J",Rv6)%%gxt[[/QR %%gxt[[/QR , &)J$Rv.!gxt[['IJ r3   )r/   r+   r,   )   N)r
   r   r8   r   rE   r   r   N)__name__
__module____qualname____firstlineno____doc__intr1   r$   r6   rJ   r   rP   rT   tuplerC   rD   __static_attributes__ r3   r&   r)   r)   >   so     $)) :);I ;S ;T ;** "* 	*
 
*X   "  	 
 
 .   "  	 
 
 .BKS#XBK c3hBK 	BK
 BK BK 
BKH-KS#X-K c3h-K 	-K
 -K 
-Kr3   r)   )rw   r   rb   typingr   r   r   r   r   cyclopts.helpr   r   r$   r'   r)   r{   r3   r&   <module>r~      sC    ; 	  %42. .i .C .bcK cKr3   