
    E^e                     B   d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	m
Z
mZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZ d Zd	 Zd
 Z ej         eddg                     ej        edd e                       ej        dd           ej        dde           ej        ddd           ej        ddd           ej        d d!           ej        d"d#dd$d%           ej        d&dd'           ej        d( ej                    dd)*           ej        d+d,dd-           ej        d.d/dd0d%           ej        d1d2d3 ej                    d45           ej        d6 ej                    dd7*           ej        d8dd9           ej        d: ej                    dd;*           ej        d< ej         g d=          d>d?*           ej        d@dAddB           ej        dCddD          dE                                                                                                                                                                                                                                     Z!e"dFk    r e!             dS dS )GzMain `cookiecutter` CLI.    N)__version__)	ContextDecodingExceptionFailedHookExceptionInvalidModeExceptionInvalidZipRepositoryOutputDirExistsExceptionRepositoryCloneFailedRepositoryNotFoundUndefinedVariableInTemplateUnknownExtension)configure_logger)cookiecutter)get_user_configc                      t           j        } t          j                            t          j                            t          j                            t                                        }dt           d| d|  dS )zAReturn the Cookiecutter version, location and Python powering it.zCookiecutter z from z	 (Python ))sysversionospathdirnameabspath__file__r   )python_versionlocations     0lib/python3.11/site-packages/cookiecutter/cli.pyversion_msgr      sY    [Nwrwrwx/H/HIIJJHR;RRhRRRRRR    c                     |D ]}d|vrt          j        d| d          t          j        d |D                       pdS )zValidate extra context.=z;EXTRA_CONTEXT should contain items of the form key=value; 'z' doesn't match that formc              3   B   K   | ]}|                     d d          V  dS )r      N)split).0ss     r   	<genexpr>z)validate_extra_context.<locals>.<genexpr>,   s.      "B"Bq1773??"B"B"B"B"B"Br   N)clickBadParametercollectionsOrderedDict)ctxparamvaluestrings       r   validate_extra_contextr.   !   st      f$66 6 6    ""B"BE"B"B"BBBJdJr   c                    t          ||           }|                    d          t          j                                      s+t          j        d            t          j        d           fdt          j	                  D             }t          j        t          |           d           |D ]}t          j        d|            dS )zMList installed (locally cloned) templates. Use cookiecutter --list-installed.cookiecutters_dirz?Error: Cannot list installed templates. Folder does not exist: c           	          g | ]B}t           j                            t           j                            |d                     @|CS )zcookiecutter.json)r   r   existsjoin)r#   foldercookiecutter_folders     r   
<listcomp>z,list_installed_templates.<locals>.<listcomp>:   sV       7>>GLL,f6IJJ
 
  r   z installed templates: z * N)r   getr   r   r3   r&   echor   exitlistdirlen)default_configpassed_config_fileconfigtemplate_namesnamer6   s        @r   list_installed_templatesrB   /   s    /@@F **%8997>>-.. 
<&9< <	
 	
 	
 	   j!455  N 
J#n%%===>>> ! !
<<<    ! !r   z-hz--help)help_option_names)context_settingsz-Vz	--version)messagetemplateF)requiredextra_contextr1   )nargscallbackz
--no-inputTzDo not prompt for parameters and only use cookiecutter.json file content. Defaults to deleting any cached resources and redownloading them. Cannot be combined with the --replay flag.)is_flaghelpz-cz
--checkoutz1branch, tag or commit to checkout after git clone)rL   z--directoryzlDirectory within repo that holds cookiecutter.json file for advanced repositories with multi templates in itz-vz	--verbosezPrint debug information)rK   rL   defaultz--replayzDo not prompt for parameters and only use information entered previously. Cannot be combined with the --no-input flag or with extra configuration passed.z--replay-filez0Use this file for replay instead of the default.)typerM   rL   z-fz--overwrite-if-existszCOverwrite the contents of the output directory if it already existsz-sz--skip-if-file-existszESkip the files in the corresponding directories if they already existz-oz--output-dir.z.Where to output the generated project dir into)rM   rN   rL   z--config-filezUser configuration filez--default-configz3Do not load a config file. Use the defaults insteadz--debug-filez-File to be used as a stream for DEBUG loggingz--accept-hooks)yesasknorP   zAccept pre/post hooksz-lz--list-installedz#List currently installed templates.z--keep-project-on-failurez'Do not delete project folder on failurec                    |r$t          |	|           t          j        d           | r|                                 dk    rKt	          j        t	          j                                                               t          j        d           t          |rdnd|
           |dk    rt	          j	        d          }n|dk    }|r|}	 t          | ||||||||	t          j                            d	          ||||
           dS # t          t          t           t"          t$          t&          t(          t*          f$ r3}t	          j        |           t          j        d           Y d}~dS d}~wt,          $ r}t	          j        |j                    t	          j        d|j        j                    t3          j        |j        dd          }t	          j        d|            t          j        d           Y d}~dS d}~ww xY w)a  Create a project from a Cookiecutter project template (TEMPLATE).

    Cookiecutter is free and open source software, developed and managed by
    volunteers. If you would like to help out or fund the project, please get
    in touch at https://github.com/cookiecutter/cookiecutter.
    r   rL   DEBUGINFO)stream_level
debug_filerQ   zDo you want to execute hooks?rP   COOKIECUTTER_REPO_PASSWORD)rH   replayoverwrite_if_exists
output_dirconfig_filer=   password	directoryskip_if_file_existsaccept_hookskeep_project_on_failurer!   NzError message:    T)indent	sort_keysz	Context: )rB   r   r:   lowerr&   r9   get_current_contextget_helpr   confirmr   r   environr8   r   r   r   r   r   r   r
   r	   r   rE   errorjsondumpscontext)rF   rH   no_inputcheckoutverboserY   rZ   r[   r\   r=   rW   r^   r_   r`   replay_filelist_installedra   _accept_hookseundefined_errcontext_strs                        r   mainrw   F   s$   \   ===  x~~''611
5,..7799:::W"@''&ZXXXX u&EFF$- #' 3!#)Z^^$@AA 3&$;	
 	
 	
 	
 	
 	
" 	! 	    	
1&   
m+-...
B]%8%@BBCCCj!6qDQQQ
,{,,---s%   :D 5H 8(E&&H 3BG;;H __main__)#__doc__r(   rk   r   r   r&   r   r   cookiecutter.exceptionsr   r   r   r   r   r	   r
   r   r   cookiecutter.logr   cookiecutter.maincookiecutter.configr   r   r.   rB   commanddictversion_optionargumentoptionPathChoicerw   __name__ r   r   <module>r      s          				 



  $ $ $ $ $ $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 . - - - - - * * * * * * / / / / / /S S SK K K! ! !. h7G H H HIIIk4kkmmLLL
U+++r4JKKK
1   	<  
 
;  
 +t*CU   
V   		;	   	N	   	P   		9   *%*,,;T   	>  
 		8	   	***	+	+	 	   
d1V   	2  
R R                LK ,+ ML JIhRj zDFFFFF r   