
    ^j                        U d Z ddlZddlmZ ddlmZ ddlZddlmZ ddl	m
Z
 dZ ej                         d	z  d
e df ej                         dz  d
e dfdZeeeeef   f   ed<    ej                         dz  dz  dz  dz  ZdefdZdedefdZdeddfdZdeddfdZee e
dedd      f   Zee e
dedd       f   Zy)!uy  Shell completion for the ``hf`` CLI, built on Click's native completion.

Click generates completion scripts activated by the ``_HF_COMPLETE`` env var (this
works out of the box because ``hf`` is a Click command). This module exposes the two
conveniences Typer used to provide — ``--install-completion`` / ``--show-completion``
— as thin eager options over that machinery.
    N)Path)	Annotated)get_completion_class   )Option_HF_COMPLETEz.bashrczeval "$(z=bash_source hf)"z.zshrcz=zsh_source hf)")bashzsh_RC_ACTIVATIONz.configfishcompletionszhf.fishreturnc                  p    t        t        j                  j                  dd            j                  xs dS )NSHELL r	   )r   osenvirongetname     j/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/huggingface_hub/cli/_completion.py_detect_shellr   -   s'    

w+,11;V;r   shellc                     ddl m} t        |       }|t        j                  d|  d       ||i dt
              j                         S )Nr   )appShell '"' is not supported for completion.hf)r   r   r   clickClickException_COMPLETE_VARsource)r   r   completion_clss      r   _completion_scriptr%   1   sJ    )%0N""WUG3U#VWW#r47>>@@r   valuec                     | sy t        j                  t        t                            t         j                  j                         )N)r    echor%   r   
exceptionsExit)r&   s    r   _show_completionr+   ;   s1    	JJ!-/23





!!r   c                 l   | sy t               }|dk(  r>t        }|j                  j                  dd       |j	                  t        d             n|t        v rt        |   \  }}|j                  j                  dd       |j                         r|j                         nd}||vrI|j                  d      5 }|j                  d| d       d d d        nt        j                  d| d      t        j                  | d	| d
       t        j                  j                         # 1 sw Y   BxY w)Nr   T)parentsexist_okr   a
r   r   z completion installed in z+. Restart your shell for it to take effect.)r   _FISH_COMPLETION_PATHparentmkdir
write_textr%   r   exists	read_textopenwriter    r!   r(   r)   r*   )r&   r   path
activationexistingfiles         r   _install_completionr=   B   s   OE$$6*623	.	 )%0j$6'+{{}4>>#"X%3 04

R
|2./0 0 ""WUG3U#VWW	JJ%1$7bcd





!!0 0s   9D**D3z--install-completionTz)Install completion for the current shell.)callbackis_eagerhelpz--show-completionzPShow completion for the current shell, to copy it or customize the installation.)__doc__r   pathlibr   typingr   r    click.shell_completionr   
_frameworkr   r"   homer   dictstrtuple__annotations__r1   r   r%   boolr+   r=   InstallCompletionOptShowCompletionOptr   r   r   <module>rN      sD   
    7   TYY[9$?P&QRDIIK("h}o=M$NO/S%c	**+  "		i/&8=H9T <s <Ac Ac A"D "T ""t " "* !
$8	  
!_	 r   