
    ]hM                       % S SK Jr  S SKJr  S SKrS SKrS SKrS SK	J	r
  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr              S)S jr " S S5      rSrSrSr " S S5      r " S S\5      r " S S\5      r " S S\5      r\R<                  " SSS9r\\\S.r S\!S '    S*     S+S! jjr"S,S" jr#S-S# jr$S.S$ jr%S/S% jr&S0S& jr'          S1S' jr(        S2S( jr)g)3    )annotationsN)gettext   )Argument)Command)Context)Group)Option)	Parameter)ParameterSource)echoc                    UR                  S5      u  pVn[        U5      nUc  gU" XX#5      nUS:X  a  [        UR                  5       5        gUS:X  a  [        UR	                  5       5        gg)a  Perform shell completion for the given CLI program.

:param cli: Command being called.
:param ctx_args: Extra arguments to pass to
    ``cli.make_context``.
:param prog_name: Name of the executable in the shell.
:param complete_var: Name of the environment variable that holds
    the completion instruction.
:param instruction: Value of ``complete_var`` with the completion
    instruction and shell, in the form ``instruction_shell``.
:return: Status code to exit with.
_r   sourcer   complete)	partitionget_completion_classr   r   r   )	clictx_args	prog_namecomplete_varinstructionshellr   comp_clscomps	            H/var/www/html/env/lib/python3.13/site-packages/click/shell_completion.pyshell_completer      sm    & (11#6Ek#E*HC9;DhT[[]j T]]_    c                  J    \ rS rSrSrSr  S         S	S jjrS
S jrSrg)CompletionItem9   a  Represents a completion value and metadata about the value. The
default metadata is ``type`` to indicate special shell handling,
and ``help`` if a shell supports showing a help string next to the
value.

Arbitrary parameters can be passed when creating the object, and
accessed using ``item.attr``. If an attribute wasn't passed,
accessing it returns ``None``.

:param value: The completion suggestion.
:param type: Tells the shell script to provide special completion
    support for the type. Click uses ``"dir"`` and ``"file"``.
:param help: String shown next to the value if supported.
:param kwargs: Arbitrary metadata. The built-in implementations
    don't use this, but custom type completions paired with custom
    shell support could use it.
valuetypehelp_infoNc                4    Xl         X l        X0l        X@l        g Nr"   )selfr#   r$   r%   kwargss        r   __init__CompletionItem.__init__N   s     "
	 $	
r   c                8    U R                   R                  U5      $ r(   )r&   get)r)   names     r   __getattr__CompletionItem.__getattr__Z   s    zz~~d##r   )r&   r%   r$   r#   )plainN)
r#   t.Anyr$   strr%   
str | Noner*   r3   returnNone)r/   r4   r6   r3   )	__name__
__module____qualname____firstlineno____doc__	__slots__r+   r0   __static_attributes__ r   r   r    r    9   sP    $ 3I
 	

 
 	

 
 

$r   r    a  %(complete_func)s() {
    local IFS=$'\n'
    local response

    response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD %(complete_var)s=bash_complete $1)

    for completion in $response; do
        IFS=',' read type value <<< "$completion"

        if [[ $type == 'dir' ]]; then
            COMPREPLY=()
            compopt -o dirnames
        elif [[ $type == 'file' ]]; then
            COMPREPLY=()
            compopt -o default
        elif [[ $type == 'plain' ]]; then
            COMPREPLY+=($value)
        fi
    done

    return 0
}

%(complete_func)s_setup() {
    complete -o nosort -F %(complete_func)s %(prog_name)s
}

%(complete_func)s_setup;
a  #compdef %(prog_name)s

%(complete_func)s() {
    local -a completions
    local -a completions_with_descriptions
    local -a response
    (( ! $+commands[%(prog_name)s] )) && return 1

    response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) %(complete_var)s=zsh_complete %(prog_name)s)}")

    for type key descr in ${response}; do
        if [[ "$type" == "plain" ]]; then
            if [[ "$descr" == "_" ]]; then
                completions+=("$key")
            else
                completions_with_descriptions+=("$key":"$descr")
            fi
        elif [[ "$type" == "dir" ]]; then
            _path_files -/
        elif [[ "$type" == "file" ]]; then
            _path_files -f
        fi
    done

    if [ -n "$completions_with_descriptions" ]; then
        _describe -V unsorted completions_with_descriptions -U
    fi

    if [ -n "$completions" ]; then
        compadd -U -V unsorted -a completions
    fi
}

if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
    # autoload from fpath, call function directly
    %(complete_func)s "$@"
else
    # eval/source/. command, register function for later
    compdef %(complete_func)s %(prog_name)s
fi
af  function %(complete_func)s;
    set -l response (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) %(prog_name)s);

    for completion in $response;
        set -l metadata (string split "," $completion);

        if test $metadata[1] = "dir";
            __fish_complete_directories $metadata[2];
        else if test $metadata[1] = "file";
            __fish_complete_path $metadata[2];
        else if test $metadata[1] = "plain";
            echo $metadata[2];
        end;
    end;
end;

complete --no-files --command %(prog_name)s --arguments "(%(complete_func)s)";
c                      \ rS rSr% SrS\S'    S\S'              SS jr\SS j5       rSS jr	SS	 jr
SS
 jrSS jrSS jrSS jrSrg)ShellComplete   a  Base class for providing shell completion support. A subclass for
a given shell will override attributes and methods to implement the
completion instructions (``source`` and ``complete``).

:param cli: Command being called.
:param prog_name: Name of the executable in the shell.
:param complete_var: Name of the environment variable that holds
    the completion instruction.

.. versionadded:: 8.0
zt.ClassVar[str]r/   source_templatec                4    Xl         X l        X0l        X@l        g r(   )r   r   r   r   )r)   r   r   r   r   s        r   r+   ShellComplete.__init__   s      "(r   c                    [         R                  " SSU R                  R                  SS5      [         R                  S9nSU S3$ )zAThe name of the shell function defined by the completion
script.
z\W* -r   )flags_completion)resubr   replaceASCII)r)   	safe_names     r   	func_nameShellComplete.func_name   s<    
 FF62t~~'='=c3'GrxxX	9+[))r   c                J    U R                   U R                  U R                  S.$ )zVars for formatting :attr:`source_template`.

By default this provides ``complete_func``, ``complete_var``,
and ``prog_name``.
)complete_funcr   r   )rP   r   r   r)   s    r   source_varsShellComplete.source_vars   s%     "^^ --
 	
r   c                <    U R                   U R                  5       -  $ )zProduce the shell script that defines the completion
function. By default this ``%``-style formats
:attr:`source_template` with the dict returned by
:meth:`source_vars`.
)rC   rU   rT   s    r   r   ShellComplete.source   s     ##d&6&6&888r   c                    [         e)zUse the env vars defined by the shell script to return a
tuple of ``args, incomplete``. This must be implemented by
subclasses.
NotImplementedErrorrT   s    r   get_completion_args!ShellComplete.get_completion_args  s
    
 "!r   c                    [        U R                  U R                  U R                  U5      n[	        X1U5      u  pBUR                  X25      $ )a,  Determine the context and last complete command or parameter
from the complete args. Call that object's ``shell_complete``
method to get the completions for the incomplete value.

:param args: List of complete args before the incomplete value.
:param incomplete: Value being completed. May be empty.
)_resolve_contextr   r   r   _resolve_incompleter   )r)   args
incompletectxobjs        r   get_completionsShellComplete.get_completions	  s?     txxM-cD!!#22r   c                    [         e)zFormat a completion item into the form recognized by the
shell script. This must be implemented by subclasses.

:param item: Completion item to format.
rZ   r)   items     r   format_completionShellComplete.format_completion  s
     "!r   c                    U R                  5       u  pU R                  X5      nU Vs/ s H  o@R                  U5      PM     nnSR                  U5      $ s  snf )zProduce the completion data to send back to the shell.

By default this calls :meth:`get_completion_args`, gets the
completions, then calls :meth:`format_completion` for each
completion.

)r\   re   rj   join)r)   ra   rb   completionsri   outs         r   r   ShellComplete.complete  sV      335**4<8CD%%d+Dyy~ Es   A)r   r   r   r   N)
r   r   r   cabc.MutableMapping[str, t.Any]r   r4   r   r4   r6   r7   r6   r4   )r6   zdict[str, t.Any]r6   ztuple[list[str], str])ra   	list[str]rb   r4   r6   zlist[CompletionItem]ri   r    r6   r4   )r8   r9   r:   r;   r<   __annotations__r+   propertyrP   rU   r   r\   re   rj   r   r>   r?   r   r   rA   rA      s    
 
 %$
)
) 2
) 	
)
 
) 

) * *

9"
3"
r   rA   c                  `   ^  \ rS rSrSrSr\r\S	S j5       r	S
U 4S jjr
SS jrSS jrSrU =r$ )BashCompletei*  zShell completion for Bash.bashc                 |   SS K n SS KnU R                  S5      nUc  S nOMUR                  USSS/UR                  S9n[
        R                  " SUR                  R                  5       5      nUb:  UR                  5       u  pVUS:  d  US:X  a  US:  a  [        [        S	5      S
S9  g g g [        [        S5      S
S9  g )Nr   r{   z--norcz-czecho "${BASH_VERSION}")stdoutz^(\d+)\.(\d+)\.\d+4zCShell completion is not supported for Bash versions older than 4.4.T)errz@Couldn't detect Bash version, shell completion is not supported.)shutil
subprocesswhichrunPIPErK   searchr}   decodegroupsr   r   )r   r   bash_exematchoutputmajorminors          r   _check_versionBashComplete._check_version0  s    <<'E^^8T+CD! $ F II3V]]5I5I5KLE <<>LEs{eslus{4  0;l TUr   c                @   > U R                  5         [        TU ]	  5       $ r(   )r   superr   )r)   	__class__s    r   r   BashComplete.sourceQ  s    w~r   c                    [        [        R                  S   5      n[        [        R                  S   5      nUSU n X   nX44$ ! [         a    Sn X44$ f = fN
COMP_WORDS
COMP_CWORDr   rG   split_arg_stringosenvironint
IndexErrorr)   cwordscwordra   rb   s        r   r\    BashComplete.get_completion_argsU  i    !"**\":;BJJ|,-a	J   	J	   A AAc                8    UR                    SUR                   3$ )N,)r$   r#   rh   s     r   rj   BashComplete.format_completiona  s    ))Adjj\**r   r?   )r6   r7   rs   rt   rv   )r8   r9   r:   r;   r<   r/   _SOURCE_BASHrC   staticmethodr   r   r\   rj   r>   __classcell__)r   s   @r   rz   rz   *  s7    $D"O @ 
 + +r   rz   c                  4    \ rS rSrSrSr\rSS jrS	S jr	Sr
g)
ZshCompleteie  zShell completion for Zsh.zshc                    [        [        R                  S   5      n[        [        R                  S   5      nUSU n X   nX44$ ! [         a    Sn X44$ f = fr   r   r   s        r   r\   ZshComplete.get_completion_argsk  r   r   c                |    UR                    SUR                   SUR                  (       a  UR                   3$ S 3$ )Nrm   r   )r$   r#   r%   rh   s     r   rj   ZshComplete.format_completionw  s7    ))Btzzl"$))TYY,MNN,MNNr   r?   Nrt   rv   )r8   r9   r:   r;   r<   r/   _SOURCE_ZSHrC   r\   rj   r>   r?   r   r   r   r   e  s    #D!O
 Or   r   c                  4    \ rS rSrSrSr\rSS jrS	S jr	Sr
g)
FishCompletei{  zShell completion for Fish.fishc                    [        [        R                  S   5      n[        R                  S   nUSS  nU(       a   U(       a  US   U:X  a  UR                  5         X24$ )Nr   r   r   )r   r   r   pop)r)   r   rb   ra   s       r   r\    FishComplete.get_completion_args  sR    !"**\":;ZZ-
abz $48z#9HHJr   c                    UR                   (       a(  UR                   SUR                   SUR                    3$ UR                   SUR                   3$ )Nr   	)r%   r$   r#   rh   s     r   rj   FishComplete.format_completion  sE    99ii[$**R		{;;))Adjj\**r   r?   Nrt   rv   )r8   r9   r:   r;   r<   r/   _SOURCE_FISHrC   r\   rj   r>   r?   r   r   r   r   {  s    $D"O
 +r   r   ShellCompleteTypeztype[ShellComplete])bound)r{   r   r   zdict[str, type[ShellComplete]]_available_shellsc                6    Uc  U R                   nU [        U'   U $ )aQ  Register a :class:`ShellComplete` subclass under the given name.
The name will be provided by the completion instruction environment
variable during completion.

:param cls: The completion class that will handle completion for the
    shell.
:param name: Name to register the class under. Defaults to the
    class's ``name`` attribute.
)r/   r   )clsr/   s     r   add_completion_classr     s"     |xx!dJr   c                ,    [         R                  U 5      $ )zLook up a registered :class:`ShellComplete` subclass by the name
provided by the completion instruction environment variable. If the
name isn't registered, returns ``None``.

:param shell: Name the class is registered under.
)r   r.   )r   s    r   r   r     s       ''r   c                    SSK nUR                  U SS9nSUl        SUl        / n U H  nUR                  U5        M     U$ ! [         a    UR                  UR
                  5         U$ f = f)a  Split an argument string as with :func:`shlex.split`, but don't
fail if the string is incomplete. Ignores a missing closing quote or
incomplete escape sequence and uses the partial token as-is.

.. code-block:: python

    split_arg_string("example 'my file")
    ["example", "my file"]

    split_arg_string("example my\")
    ["example", "my"]

:param string: String to split.

.. versionchanged:: 8.2
    Moved to ``shell_completion`` from ``parser``.
r   NT)posixrG   )shlexwhitespace_split
commentersappend
ValueErrortoken)stringr   lexrp   r   s        r   r   r     sw    $ 
++fD+
)CCCN
CEJJu  J   	

399Js   A %A+*A+c                   [        U[        5      (       d  gUR                  c   eU R                  R	                  UR                  5      nUR
                  S:H  =(       d}    U R                  UR                  5      [        R                  L=(       dK    UR
                  S:  =(       a5    [        U[        [        45      =(       a    [        U5      UR
                  :  $ )zDetermine if the given parameter is an argument that can still
accept values.

:param ctx: Invocation context for the command represented by the
    parsed complete args.
:param param: Argument object being checked.
Fr   r   )
isinstancer   r/   paramsr.   nargsget_parameter_sourcer   COMMANDLINEtuplelistlen)rc   paramr#   s      r   _is_incomplete_argumentr     s     eX&&::!!!JJNN5::&Er 	
##EJJ/7R7RR	
 KK!O )55$-0)E
U[[(r   c                8    U(       d  gUS   nX R                   ;   $ )z5Check if the value looks like the start of an option.Fr   )_opt_prefixes)rc   r#   cs      r   _start_of_optionr     s     aA!!!!r   c                6   [        U[        5      (       d  gUR                  (       d  UR                  (       a  gSn[	        [        U5      5       H.  u  pEUS-   UR                  :  a    O[        X5      (       d  M,  UnM0     USL=(       a    X2R                  ;   $ )zDetermine if the given parameter is an option that needs a value.

:param args: List of complete args before the incomplete value.
:param param: Option object being checked.
FNr   )	r   r
   is_flagcount	enumeratereversedr   r   opts)rc   ra   r   last_optionindexargs         r   _is_incomplete_optionr     sz     eV$$}}K/
19u{{"C%%K 0 d"@{jj'@@r   c           
     0   SUS'   U R                   " X#R                  5       40 UD6 nUR                  UR                  -   nU(       Ga  UR                  n[        U[        5      (       a  UR                  (       dX  UR                  XC5      u  pgnUc  UsSSS5        $ UR                  XcUSS9 nUnUR                  UR                  -   nSSS5        O}UnU(       aV  UR                  XC5      u  pgnUc  UsSSS5        $ UR                  UUUSSSS9 n	U	nUR                  nSSS5        U(       a  MV  Un/ UR                  QUR                  QnOO
U(       a  GM  SSS5        U$ ! , (       d  f       N"= f! , (       d  f       NZ= f! , (       d  f       W$ = f)aH  Produce the context hierarchy starting with the command and
traversing the complete arguments. This only follows the commands,
it doesn't trigger input prompts or callbacks.

:param cli: Command being called.
:param prog_name: Name of the executable in the shell.
:param args: List of complete args before the incomplete value.
Tresilient_parsingN)parentr   F)r   allow_extra_argsallow_interspersed_argsr   )	make_contextcopy_protected_argsra   commandr   r	   chainresolve_command)
r   r   r   ra   rc   r   r/   cmdsub_ctxsub_sub_ctxs
             r   r_   r_     s    %)H !			)YY[	=H	=""SXX-kkG'5))}}&-&=&=c&HODt{" 
>	= ))3$ *  %"22SXX=	  "G*1*A*A#*L4;#&3 
>	=6 !--  #&-149.2 .  )&1G#*<<D $" "CDW44Dw||DDM d 
>V J=  7 
>	=V JsN   A,FF.E$
*F>FE5!F2%F$
E2	.F5
F	?F
Fc                   US:X  a  SnO;SU;   a5  [        X5      (       a%  UR                  S5      u  p4nUR                  U5        SU;  a  [        X5      (       a  U R                  U4$ U R                  R	                  U 5      nU H  n[        XU5      (       d  M  Xb4s  $    U H  n[        X5      (       d  M  Xb4s  $    U R                  U4$ )aP  Find the Click object that will handle the completion of the
incomplete value. Return the object and the incomplete value.

:param ctx: Invocation context for the command represented by
    the parsed complete args.
:param args: List of complete args before the incomplete value.
:param incomplete: Value being completed. May be empty.
=rG   z--)r   r   r   r   
get_paramsr   r   )rc   ra   rb   r/   r   r   r   s          r   r`   r`   X  s     S
	
	/@@(2237D 4,S=={{J&&[[##C(F  E22$$  "3..$$  ;;
""r   )r   r   r   rr   r   r4   r   r4   r   r4   r6   r   r(   )r   r   r/   r5   r6   r   )r   r4   r6   ztype[ShellComplete] | None)r   r4   r6   ru   )rc   r   r   r   r6   bool)rc   r   r#   r4   r6   r   )rc   r   ra   ru   r   r   r6   r   )
r   r   r   rr   r   r4   ra   ru   r6   r   )rc   r   ra   ru   rb   r4   r6   ztuple[Command | Parameter, str])*
__future__r   collections.abcabccabcr   rK   typingtr   r   corer   r   r   r	   r
   r   r   utilsr   r   r    r   r   r   rA   rz   r   r   TypeVarr   r   rw   r   r   r   r   r   r   r_   r`   r?   r   r   <module>r     s   "  	 	          ! #	#-# # 	#
 # 	#L"$ "$L@*X.e eP8+= 8+vO- O,+= +2 II19NO  5 1  04	",(("J2"A0:	:-: : 	:
 :z,#	,#!,#/2,#$,#r   