ó
    æ“,j¡  ã                   ó  • S SK r S SKrS SKJr  S SKJr  S SKrS SKJr  SSK	J
r
  SSKJrJrJrJr  SS	KJrJrJrJrJrJr  \
R.                  r\
R2                  rS
S/r\R8                  " S5      \" SSS9\" SSSS9\" \SSSS9\" SSSSSR;                  \5       3S9\" SSSSS94S\R<                  S\S\\   S \S!\\   S"\ 4S# jj5       r!\
R.                  \
R2                  S\S$.S\S\S \S!\S"\ S%\S&S4S' jjr"S\S\S \S&S4S( jr#g))é    N)ÚPath)ÚOptional)Úmsgé   )Úabout)Úensure_pathÚget_git_versionÚgit_checkoutÚgit_repo_branch_existsé   )ÚCOMMANDÚPROJECT_FILEÚArgÚOptÚ_get_parent_commandÚappÚmainÚmasterÚclone.z!The name of the template to clone)ÚhelpzAWhere to clone the project. Defaults to current working directoryF)r   Úexistsz--repoz-rzThe repository to clone fromz--branchz-bz8The branch to clone from. If not provided, will attempt ú, z--sparsez-SzZUse sparse Git checkout to only check out and clone the files needed. Requires Git v22.2+.ÚctxÚnameÚdestÚrepoÚbranchÚsparse_checkoutc           	      óþ  • Uc.  [         R                  " 5       [        U5      R                  S   -  nU[        :X  a	  Uc  [        nUcZ  [
         H  n[        X65      (       d  M  Un  O   Uc5  SR                  S [
         5       5      n[        R                  " SU S3SS9  O,[        X45      (       d  [        R                  " S	U S
U S3SS9  [        U[        5      (       d   e[        U 5      n[        UUUUUUS9  g)aC  Clone a project template from a repository. Calls into "git" and will
only download the files from the given subdirectory. The GitHub repo
defaults to the official Weasel template repo, but can be customized
(including using a private repo).

DOCS: https://github.com/explosion/weasel/tree/main/docs/cli.md#clipboard-clone
Néÿÿÿÿr   c              3   ó.   #   • U  H  nS U S 3v •  M     g7f)Ú'N© )Ú.0Úbs     ÚžC:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\weasel/cli/clone.pyÚ	<genexpr>Ú$project_clone_cli.<locals>.<genexpr>/   s   é € Ð,PÒ?O¸!¨q°°°1­XÒ?Oùs   ‚z2No branch provided and attempted default branches z do not exist.r   ©Úexitszrepo: z
 (branch: z) does not exist.©r   r   r   Úparent_command)r   ÚcwdÚpartsÚDEFAULT_REPOÚDEFAULT_PROJECTS_BRANCHÚDEFAULT_BRANCHESr   Újoinr   ÚfailÚ
isinstanceÚstrr   Úproject_clone)	r   r   r   r   r   r   Údefault_branchÚdefault_branches_msgr,   s	            r&   Úproject_clone_clir9      sý   € ð$ �|Ü�xŠx‹zœD ›J×,Ñ,¨RÑ0Ñ0ˆØŒ|Ó ¡Ü(ˆà�~ß.ˆNÜ% d×;Ó;Ø'�Ùñ /ð ‰>Ø#'§9¡9Ñ,PÕ?OÓ,PÓ#PÐ Ü�HŠHðØ0Ð1°ðAàòøô & d×3Ñ3Ü�HŠH�v˜d˜V :¨f¨XÐ5FÐGÈqÒQÜ�fœc×"Ñ"Ð"Ð"Ü(¨Ó-€NÜØØØØØ'Ø%óó    r+   r,   Úreturnc          	      ó  • [        U5      n[        XU5        UR                  5       n[        R                  " SSU5      n [        X XUS9  [        R                  " S
U  SU SU S3U5        U[        -  R                  5       (       d  [        R                  " S[         S35        g[        R                  " S5        [        SU SU 35        g! [        R                   a$    SU  SU SU S3n[        R                  " USS	9   N»f = f)zêClone a project template from a repository.

name (str): Name of subdirectory to clone.
dest (Path): Destination path of cloned project.
repo (str): URL of Git repo containing project templates.
branch (str): The branch to clone from
z(http(s?)):\/\/github.com/Ú )r   ÚsparsezCould not clone 'z' from repo 'z' (branch 'z')r   r)   zCloned 'z' from 'zNo z found in directoryzYour project is now ready!zTo fetch the assets, run:
z assets N)r   Úcheck_cloneÚresolveÚreÚsubr
   Ú
subprocessÚCalledProcessErrorr   r3   Úgoodr   r   ÚwarnÚprint)	r   r   r   r   r   r,   Úproject_dirÚ	repo_nameÚerrs	            r&   r6   r6   D   sú   € ô  �tÓ€DÜ�˜DÔ!Ø—,‘,“.€KÜ—’Ð4°b¸$Ó?€IðÜ�T ¸_ÒMô ‡H‚Hˆx˜�v˜X i [°¸F¸8À2ÐFÈÔTØœ,Ñ&×.Ñ.×0Ñ0Ü�Š�3”|�nÐ$7Ð8Õ9ä�ŠÐ-Ô.ÜÐ+¨NÐ+;¸8ÀDÀ6ÐJÕKøô ×(Ñ(ó Ø! $  }°Y°K¸{È6È(ÐRTÐUˆÜ�Š�˜AÔðús   ÁC Ã5DÄDc                 óL  • SU  SU SU S3n[        US9  U(       d  [        R                  " SU 3SS9  UR                  5       (       a  [        R                  " S	U 3SS9  UR                  R                  5       (       d$  [        R                  " S
UR                   S3SS9  gg)a)  Check and validate that the destination path can be used to clone. Will
check that Git is available and that the destination path is suitable.

name (str): Name of the directory to clone from the repo.
dest (Path): Local destination of cloned directory.
repo (str): URL of the repo to clone from.
z~Cloning Weasel project templates requires Git and the 'git' command. To clone a project without Git, copy the files from the 'z' directory in the z to z
 manually.)Úerrorz(Not a valid directory to clone project: r   r)   z/Can't clone project, directory already exists: z5Can't clone project, parent directory doesn't exist: z9. Create the necessary folder(s) first before continuing.N)r	   r   r3   r   Úparent)r   r   r   Úgit_errs       r&   r?   r?   e   s®   € ðDØDHÀ6ð JØ ˜6  d V¨:ð	7ð ô
 ˜'Ò"ÞÜ�ŠÐ;¸D¸6ÐBÈ!ÒLØ‡{�{‡}�}ä�ŠÐBÀ4À&ÐIÐQRÒSØ�;‰;×Ñ×Ñä�ŠØCÀDÇKÁKÀ=ð QFð Gàó	
ð  r:   )$rA   rC   Úpathlibr   Útypingr   ÚtyperÚwasabir   r=   r   Úutilr   r	   r
   r   r   r   r   r   r   r   r   Ú__projects__r/   Ú__projects_branch__r0   r1   Úcommandr2   ÚContextr5   Úboolr9   r6   r?   r#   r:   r&   Ú<module>rY      s´  ðÛ 	Û Ý Ý ã Ý å ß UÓ Uß K× Kà×!Ñ!€Ø×3Ñ3Ð Ø˜HÐ%Ð ð ‡‚ˆWÓñ �CÐAÑBÙ˜tÐ*mÐv{Ñ|Ù�L (¨DÐ7UÑVÙ  j°$Ð?wÐx|÷  yBñ  yBð  CSó  yTð  xUð  >Vñ  WÙ  z°4ð  ?[ñ  \ñ.à	�‰ð.ð ð.ð �4‰.ð	.ð
 ð.ð �S‰Mð.ð ô.ó ð.ðj ×"Ñ"Ø×+Ñ+Ø!Ø!òLØ
ðLà
ðLð ð	Lð
 ðLð ðLð ðLð 
õLðB
�cð 
 ð 
¨Sð 
°Tõ 
r:   