
    !<i                     T   d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZ d
 Z ee          Z ej         ed                    	 ddddddedeedz   ede          f         dee	dz   ede          f         dedef
d            ZdS )z1Generate documentation for Cyclopts applications.    )Path)	Annotated)app)FORMAT_ALIASES	DocFormatnormalize_format)Group)load_app_from_script)	Parameter)UNSETc                    |                      d          }|                      d          }|j        t          u r|j        t          u rt          d          |j        rt	          |j        d          st          d          |j        j                                        }|st          d          |                    d          }|st          d          t          j         |          }|`d	 t          j	                    D             }t          d
| dd
                    t          t          |                               d          ||_        d S d S )Nz--formatz--outputz>"--format" must be specified when output path is not provided.suffixzB"--output" must be a valid file path when format is not specified.zOutput file must have an extension to infer format (e.g., .md, .html, .rst). Please specify "--format" explicitly or add an extension to the output file..zwInvalid file extension. Output file must have a valid extension after the period. Please specify "--format" explicitly.c                 >    g | ]}t          |          d k    d| S )   r   )len).0exts     /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/cyclopts/cli/docs.py
<listcomp>z+_format_group_validator.<locals>.<listcomp>1   s3    #`#`#`#RUVYRZRZ^_R_R_IIIR_R_R_    z+Cannot infer format from output extension "z". Supported extensions: z, z'. Please specify "--format" explicitly.)getvaluer   
ValueErrorhasattrr   lowerlstripr   keysjoinsortedset)argument_collection
format_arg
output_argr   
suffix_keyinferred_formatsupported_extensionss          r   _format_group_validatorr(      s   $((44J$((44J5  u$$]^^^ 	cwz/?'J'J 	cabbb!(..00 	_   ]]3''
 	8  
 ),Z88"#`#`9L9N9N#`#`#` 9f 9 9)-6#>R:S:S3T3T)U)U9 9 9   +
E ! r   )	validator )negative)default_parameterNF   )formatinclude_hiddenheading_levelscriptoutputz-o)aliasgroupr.   z-fr/   r0   c                    |t          d          t          |          }t          |           \  }}|                    |||          }|r|                    |           dS t          |           dS )a  Generate documentation for a Cyclopts application.

    Parameters
    ----------
    script : str
        Python script path, optionally with ``':app_object'`` notation to specify
        the App object. If not specified, will search for App objects in the
        script's global namespace.
    output : Optional[Path]
        Output file path. If not specified, prints to stdout.
    format : Optional[DocFormat]
        Output format for documentation. If not specified, inferred from output
        file extension.
    include_hidden : bool
        Include hidden commands in documentation.
    heading_level : int
        Starting heading level for markdown format.
    NzMust specify format.)output_formatr/   r0   )r   r   r
   generate_docs
write_textprint)r1   r2   r.   r/   r0   app_obj_docs_contents           r   r7   r7   >   s    < ~/000f%%F%f--JGQ((%# )  L  ,'''''lr   )N)__doc__pathlibr   typingr   cyclopts.clir   cyclopts.docs.typesr   r   r   cyclopts.groupr	   cyclopts.loaderr
   cyclopts.parameterr   cyclopts.utilsr   r(   format_groupcommandstrboolintr7    r   r   <module>rL      s   7 7                           
 !           0 0 0 0 0 0 ( ( ( ( ( (            &+ &+ &+R u6777 yy"555666 QU* 	 * * **dTk994|#L#L#LLM* D	L111	3	* * * * * 76* * *r   