
    CjZX                    R   % 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              S3S jr\R,                  (       a  S SKJr  \" SS\R2                  S9rO\R0                  " SSS9r " S S\R6                  \   5      rSrSrSr " S S\R@                  5      r! " S S5      r" " S S\"5      r# " S S\"5      r$ " S  S!\"5      r%\#\%\$S".r&S#\'S$'   \R0                  " S%SS&9r( S4     S5S' jjr)\RT                  S6S( j5       r+\RT                  S7S) j5       r+\RT                  S8S* j5       r+\RT                  S9S+ j5       r+S9S, jr+S:S- jr,S;S. jr-S<S/ jr.S=S0 jr/          S>S1 jr0        S?S2 jr1g)@    )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       R	                  5       SS9  gUS:X  a(  [        UR                  5       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   sourceF)nlr   complete)	partitionget_completion_classr   r   encoder   )	clictx_args	prog_namecomplete_varinstructionshellr   comp_clscomps	            h/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/click/shell_completion.pyshell_completer      s    & (11#6Ek#E*HC9;D hT[[]!!#.j T]]_##%&    )TypeVar
_ValueT_coT)	covariantdefault)r#   c                  J    \ rS rSrSrSr  S         S	S jjrS
S jrSrg)CompletionItemC   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__X   s     "'
	 $	
r    c                8    U R                   R                  U5      $ r.   )r,   get)r/   names     r   __getattr__CompletionItem.__getattr__d   s    zz~~d##r    )r,   r+   r*   r)   )plainN)
r)   r"   r*   strr+   
str | Noner0   t.AnyreturnNone)r5   r9   r<   r;   )	__name__
__module____qualname____firstlineno____doc__	__slots__r1   r6   __static_attributes__ r    r   r&   r&   C   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                  4    \ rS rSr% S\S'   S\S'   S\S'   Srg)_SourceVarsDict   r9   complete_funcr   r   rE   N)r>   r?   r@   rA   __annotations__rD   rE   r    r   rG   rG      s    Nr    rG   c                      \ rS rSr% SrS\S'    S\S'    S\S'   S\S	'   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
t.ClassVar[str]r5   source_templater   r   cabc.MutableMapping[str, t.Any]r   r9   r   r   c                4    Xl         X l        X0l        X@l        g r.   )r   r   r   r   )r/   r   r   r   r   s        r   r1   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``.
)rI   r   r   )r]   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`.
)rO   ra   r`   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.
NotImplementedErrorr`   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.
rf   r/   items     r   format_completionShellComplete.format_completion2  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.

)rh   rq   rv   join)r/   rm   rn   completionsru   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   rP   r   r9   r   r9   r<   r=   r<   r9   )r<   rG   r<   ztuple[list[str], str])rm   	list[str]rn   r9   r<   zlist[CompletionItem[str]]ru   zCompletionItem[str]r<   r9   )r>   r?   r@   rA   rB   rJ   r1   propertyr]   ra   r   rh   rq   rv   r   rD   rE   r    r   rL   rL      s    
 
 %$ 
L--N
)
) 2
) 	
)
 
) 

) * *

9"33+.3	"3"
r    rL   c                  v   ^  \ rS rSr% SrSrS\S'   \rS\S'   \	SS j5       r
SU 4S jjrSS	 jrSS
 jrSrU =r$ )BashCompleteiG  zShell completion for Bash.bashrN   r5   rO   c                 |   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PIPErX   searchr   decodegroupsr   r   )r   r   bash_exematchoutputmajorminors          r   _check_versionBashComplete._check_versionM  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.sourcen  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   rT   split_arg_stringosenvironint
IndexErrorr/   cwordscwordrm   rn   s        r   rh    BashComplete.get_completion_argsr  i    !"**\":;BJJ|,-a	J   	J	   A AAc                8    UR                    SUR                   3$ )N,)r*   r)   rt   s     r   rv   BashComplete.format_completion~  s    ))Adjj\**r    rE   )r<   r=   r~   r   )ru   zCompletionItem[t.Any]r<   r9   )r>   r?   r@   rA   rB   r5   rJ   _SOURCE_BASHrO   staticmethodr   r   rh   rv   rD   __classcell__)r   s   @r   r   r   G  sA    $"D/"'3O_3 @ 
 + +r    r   c                  J    \ rS rSr% SrSrS\S'   \rS\S'   SS jr	SS jr
S	rg
)ZshCompletei  zShell completion for Zsh.zshrN   r5   rO   c                    [        [        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   rh   ZshComplete.get_completion_args  r   r   c                    UR                   =(       d    SnUS:w  a  UR                  R                  SS5      OUR                  nUR                   SU SU 3$ )Nr   :z\:ry   )r+   r)   rZ   r*   )r/   ru   help_r)   s       r   rv   ZshComplete.format_completion  sO    		 S 383,

""3.DJJ))BugRw//r    rE   Nr   r   )r>   r?   r@   rA   rB   r5   rJ   _SOURCE_ZSHrO   rh   rv   rD   rE   r    r   r   r     s#    #!D/!'2O_2
 0r    r   c                  J    \ rS rSr% SrSrS\S'   \rS\S'   SS jr	SS jr
S	rg
)FishCompletei  zShell completion for Fish.fishrN   r5   rO   c                    [        [        R                  S   5      n[        R                  S   nU(       a  [        U5      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   r   pop)r/   r   rn   rm   s       r   rh    FishComplete.get_completion_args  sd    !"**\":;ZZ-
)*5a8Jabz $48z#9HHJr    c                    UR                   (       aJ  UR                   R                  SS5      R                  SS5      nUR                   SUR                   SU 3$ UR                   SUR                   3$ )z
.. versionchanged:: 8.4.2
    Escape newlines and replace tabs with spaces in the help text to
    fix completion errors with multi-line help strings.
ry   z\n	 r   )r+   rZ   r*   r)   )r/   ru   r   s      r   rv   FishComplete.format_completion  sf     99II%%dE2::4EEii[$**Rw77))Adjj\**r    rE   Nr   r   )r>   r?   r@   rA   rB   r5   rJ   _SOURCE_FISHrO   rh   rv   rD   rE   r    r   r   r     s#    $"D/"'3O_3 +r    r   )r   r   r   z't.Final[dict[str, type[ShellComplete]]]_available_shells_ShellCompleteT)boundc                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.
)r5   r   )clsr5   s     r   add_completion_classr     s"     |xx!dJr    c                    g r.   rE   r   s    r   r   r         JMr    c                    g r.   rE   r   s    r   r   r     r   r    c                    g r.   rE   r   s    r   r   r     s    HKr    c                    g r.   rE   r   s    r   r   r     s    DGr    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   r4   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)posixrT   )shlexwhitespace_split
commentersappend
ValueErrortoken)stringr   lexr|   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                  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   paramsr4   r5   nargsget_parameter_sourcer   COMMANDLINEtuplelistlen)ro   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)ro   r)   cs      r   _start_of_optionr   6  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  O   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)ro   rm   r   last_optionindexargs         r   _is_incomplete_optionr   ?  s}     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_argsrm   commandr   r	   chainresolve_command)
r   r   r   rm   ro   r  r5   cmdsub_ctxsub_sub_ctxs
             r   rk   rk   X  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.
=rT   z--)r   r   r   r  
get_paramsr   r   )ro   rm   rn   r5   r   r   r   s          r   rl   rl     s     S
	
	/@@(2237D 4,S=={{J&&[[##C(F  E22$$  "3..$$  ;;
""r    )r   r   r   rP   r   r9   r   r9   r   r9   r<   zt.Literal[0, 1]r.   )r   type[_ShellCompleteT]r5   r:   r<   r
  )r   zt.Literal['bash']r<   ztype[BashComplete])r   zt.Literal['fish']r<   ztype[FishComplete])r   zt.Literal['zsh']r<   ztype[ZshComplete])r   r9   r<   ztype[ShellComplete] | None)r   r9   r<   r   )ro   r   r   r   r<   bool)ro   r   r)   r9   r<   r  )ro   r   rm   r   r   r   r<   r  )
r   r   r   rP   r   r9   rm   r   r<   r   )ro   r   rm   r   rn   r9   r<   ztuple[Command | Parameter, str])2
__future__r   collections.abcabccabcr   rX   typingtr   r   corer   r   r   r	   r
   r   r   utilsr   r   TYPE_CHECKINGtyping_extensionsr!   Anyr"   Genericr&   r   r   r   	TypedDictrG   rL   r   r   r   r   rJ   r   r   overloadr   r   r   r   r   rk   rl   rE   r    r   <module>r     s   "  	 	          ! $	$-$ $ 	$
 $ $N ??) quuEJ<48J"$QYYz* "$LL*X.akk l l^8+= 8+v!0- !0H"+= "+L > :  ))-_E 48	&0(  M  M M  M K  K G  G("J."A2:	:-: : 	:
 :z,#	,#!,#/2,#$,#r    