%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/click/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/click/__pycache__/shell_completion.cpython-312.pyc

�

D�d�G���UddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZd
edej$eej(fdedededefd�ZGd�d�ZdZdZdZGd�d�ZGd�de�ZGd�de�ZGd�d e�Zej>d!ej@e�"�Z!eeed#�Z"ejFeej@efe$d$<	d4d%e!d&ejJede!fd'�Z&d(edejJej@efd)�Z'd*e	d+ede(fd,�Z)d*e	d-ede(fd.�Z*d*e	d/ejVed+ede(fd0�Z,d
edej$eej(fded/ejVede	f
d1�Z-d*e	d/ejVed2edej\ej^eefeffd3�Z0y)5�N)�gettext�)�Argument)�BaseCommand)�Context)�MultiCommand)�Option)�	Parameter)�ParameterSource)�split_arg_string)�echo�cli�ctx_args�	prog_name�complete_var�instruction�returnc���|jd�\}}}t|�}|�y|||||�}|dk(rt|j��y|dk(rt|j	��yy)aPerform 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
rr)	rrrrr�shellr�comp_cls�comps	         �8/usr/lib/python3/dist-packages/click/shell_completion.py�shell_completerss��&(�1�1�#�6��E�1�k�#�E�*�H�����C��9�l�;�D��h���T�[�[�]����j� ��T�]�]�_����c��eZdZdZdZ		ddejdedejedejddf
d	�Z	d
edejfd�Z
y)
�CompletionItema)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�_infoNr#r$r%�kwargsrc�<�||_||_||_||_y�Nr")�selfr#r$r%r's     r�__init__zCompletionItem.__init__Ls ��"��
���	�%)��	���
r�namec�8�|jj|�Sr))r&�get)r*r,s  r�__getattr__zCompletionItem.__getattr__Xs���z�z�~�~�d�#�#r)�plainN)�__name__�
__module__�__qualname__�__doc__�	__slots__�t�Any�str�Optionalr+r/�rrr!r!7sr���$3�I�
� $�	
��u�u�
��
��j�j��o�	
�
�%�%�
�
�
�$��$����$rr!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
aXfunction %(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
��eZdZUdZej
eed<	ej
eed<	dedejeejfdededd	f
d
�Zedefd��Z
dejeejffd�Zdefd
�Zdej"ej$eeffd�Zdej$ededej$efd�Zdedefd�Zdefd�Zy	)�
ShellCompletea�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
    r,�source_templaterrrrrNc�<�||_||_||_||_yr))rrrr)r*rrrrs     rr+zShellComplete.__init__�s!����� ��
�"���(��rc��tjdd|jjdd�tj�}d|�d�S)zQThe name of the shell function defined by the completion
        script.
        z\W*��-r�_completion)�re�subr�replace�ASCII)r*�	safe_names  r�	func_namezShellComplete.func_name�s<��
�F�F�6�2�t�~�~�'=�'=�c�3�'G����R�	��9�+�[�)�)rc�J�|j|j|jd�S)z�Vars for formatting :attr:`source_template`.

        By default this provides ``complete_func``, ``complete_var``,
        and ``prog_name``.
        )�
complete_funcrr)rHrr�r*s r�source_varszShellComplete.source_vars�s%��"�^�^� �-�-����
�	
rc�<�|j|j�zS)z�Produce the shell script that defines the completion
        function. By default this ``%``-style formats
        :attr:`source_template` with the dict returned by
        :meth:`source_vars`.
        )r=rLrKs rrzShellComplete.source�s���#�#�d�&6�&6�&8�8�8rc��t�)z�Use the env vars defined by the shell script to return a
        tuple of ``args, incomplete``. This must be implemented by
        subclasses.
        ��NotImplementedErrorrKs r�get_completion_argsz!ShellComplete.get_completion_argss
��
"�!r�args�
incompletec��t|j|j|j|�}t	|||�\}}|j||�S)aTDetermine 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_contextrrr�_resolve_incompleter)r*rRrS�ctx�objs     r�get_completionszShellComplete.get_completionssE���t�x�x��������M��-�c�4��D���Z��!�!�#�z�2�2r�itemc��t�)z�Format a completion item into the form recognized by the
        shell script. This must be implemented by subclasses.

        :param item: Completion item to format.
        rO�r*rZs  r�format_completionzShellComplete.format_completions
��"�!rc��|j�\}}|j||�}|D�cgc]}|j|���}}dj|�Scc}w)z�Produce 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.
        �
)rQrYr]�join)r*rRrS�completionsrZ�outs      rrzShellComplete.completes[�� �3�3�5���j��*�*�4��<��8C�D��t�%�%�d�+�D��D��y�y��~���Es�A)r1r2r3r4r6�ClassVarr8�__annotations__r�MutableMappingr7r+�propertyrH�DictrLr�Tuple�ListrQr!rYr]rr:rrr<r<�s,��
��*�*�S�/���
�Z�Z��_�$��
)�
�
)��"�"�3����:�.�
)��	
)�
�
)�
�
)��*�3�*��*�

�Q�V�V�C����J�/�

�9��9�"�Q�W�W�Q�V�V�C�[�#�-=�%>�"�3��F�F�3�K�3�-0�3�	
����	�3�"�n�"��"�
�#�
rr<c���eZdZdZdZeZd	d�Zdef�fd�Z	de
je
jeeffd�Z
dedefd�Z�xZS)
�BashCompletezShell completion for Bash.�bashrc�@�ddl}|jgd�|j��}tjd|j
j
��}|�8|j�\}}|dks
|dk(r|dkrttd���yyttd���)Nr)rlz-czecho "${BASH_VERSION}")�stdoutz^(\d+)\.(\d+)\.\d+�4zCShell completion is not supported for Bash versions older than 4.4.z@Couldn't detect Bash version, shell completion is not supported.)
�
subprocess�run�PIPErC�searchrn�decode�groups�RuntimeErrorr)r*rp�output�match�major�minors      r�_check_versionzBashComplete._check_version0s�������4�Z�_�_� �
���	�	�/����1E�1E�1G�H���� �<�<�>�L�E�5��s�{�e�s�l�u�s�{�"��4����0;�l���T�U��
rc�@��|j�t�|�	�Sr))r{�superr)r*�	__class__s �rrzBashComplete.sourceGs��������w�~��rc��ttjd�}ttjd�}|d|}	||}||fS#t$rd}Y||fSwxYw�N�
COMP_WORDS�
COMP_CWORDrr@�r�os�environ�int�
IndexError�r*�cwords�cwordrRrSs     rrQz BashComplete.get_completion_argsK�o��!�"�*�*�\�":�;���B�J�J�|�,�-���a����	����J��Z�����	��J��Z���	���A�A�ArZc�8�|j�d|j��S)N�,)r$r#r\s  rr]zBashComplete.format_completionWs���)�)��A�d�j�j�\�*�*r)rN)r1r2r3r4r,�_SOURCE_BASHr=r{r8rr6rhrirQr!r]�
__classcell__)r~s@rrkrk*sV���$��D�"�O��. �� �
 �Q�W�W�Q�V�V�C�[�#�-=�%>�
 �+�n�+��+rrkc�l�eZdZdZdZeZdejeje
e
ffd�Zdede
fd�Z
y)�ZshCompletezShell completion for Zsh.�zshrc��ttjd�}ttjd�}|d|}	||}||fS#t$rd}Y||fSwxYwr�r�r�s     rrQzZshComplete.get_completion_argsar�r�rZc�r�|j�d|j�d|jr|j��Sd��S)Nr_r)r$r#r%r\s  rr]zZshComplete.format_completionms7���)�)��B�t�z�z�l�"�$�)�)�T�Y�Y�,M�N�N��,M�N�NrN)r1r2r3r4r,�_SOURCE_ZSHr=r6rhrir8rQr!r]r:rrr�r�[sG��#��D�!�O�
 �Q�W�W�Q�V�V�C�[�#�-=�%>�
 �O�n�O��Orr�c�l�eZdZdZdZeZdejeje
e
ffd�Zdede
fd�Z
y)�FishCompletezShell completion for Fish.�fishrc��ttjd�}tjd}|dd}|r|r|d|k(r|j�||fS)Nr�r�r���)rr�r��pop)r*r�rSrRs    rrQz FishComplete.get_completion_argswsT��!�"�*�*�\�":�;���Z�Z��-�
��a�b�z���$�4��8�z�#9��H�H�J��Z��rrZc��|jr(|j�d|j�d|j��S|j�d|j��S)Nr��	)r%r$r#r\s  rr]zFishComplete.format_completion�sE���9�9��i�i�[��$�*�*��R��	�	�{�;�;��)�)��A�d�j�j�\�*�*rN)r1r2r3r4r,�_SOURCE_FISHr=r6rhrir8rQr!r]r:rrr�r�qsD��$��D�"�O�
 �Q�W�W�Q�V�V�C�[�#�-=�%>�
 �+�n�+��+rr��ShellCompleteType)�bound)rlr�r��_available_shells�clsr,c�4�|�|j}|t|<|S)amRegister 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�)r�r,s  r�add_completion_classr��s"���|��x�x��!��d���Jrrc�,�tj|�S)z�Look 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.)rs rrr�s��� � ��'�'rrW�paramc��t|t�sy|j�J�|jj	|j�}|j
dk(xsn|j
|j�tjuxsA|j
dkDxr0t|ttf�xrt|�|j
kS)z�Determine 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)�
isinstancerr,�paramsr.�nargs�get_parameter_sourcer�COMMANDLINE�tuple�list�len)rWr�r#s   r�_is_incomplete_argumentr��s����e�X�&���:�:�!�!�!��J�J�N�N�5�:�:�&�E�
���r��	
��#�#�E�J�J�/��7R�7R�R�	
�
�K�K�!�O�
)��5�5�$�-�0�
)��E�
�U�[�[�(�
rr#c�.�|sy|d}||jvS)z5Check if the value looks like the start of an option.Fr)�
_opt_prefixes)rWr#�cs   r�_start_of_optionr��s"����
�a��A���!�!�!�!rrRc��t|t�sy|js|jryd}t	t|��D](\}}|dz|jkDrnt||�s�'|}�*|duxr||jvS)z�Determine 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)rWrRr��last_option�index�args      r�_is_incomplete_optionr��s���e�V�$���}�}������K�����/��
��s��1�9�u�{�{�"���C��%��K���d�"�@�{�e�j�j�'@�@rc�:�d|d<|j||j�fi|��}|j|jz}|r�|j}t|t�r�|jsI|j||�\}}}|�|S|j|||d��}|j|jz}nd|}|r@|j||�\}}}|�|S|j|||ddd��}|j}|r�@|}g|j�|j�}n	|S|r��|S)a`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_parsing)�parentr�F)r��allow_extra_args�allow_interspersed_argsr�)	�make_context�copy�protected_argsrR�commandr�r�chain�resolve_command)	rrrrRrWr�r,�cmd�sub_ctxs	         rrUrU�sF��%)�H�
 �!�
�#�
�
�9�d�i�i�k�
>�X�
>�C�������(�D�
��+�+���g�|�,��=�=�")�"9�"9�#�t�"D���c�4��;��J��&�&�t�T�#�QU�&�V���)�)�C�H�H�4�����&-�&=�&=�c�4�&H�O�D�#�t��{�"�
�!�.�.���"�)-�05�*.�
/��G�#�<�<�D�� ��?��/�/�?�'�,�,�?����J�I�H�JrrSc�r�|dk(rd}n6d|vr2t||�r&|jd�\}}}|j|�d|vrt||�r|j|fS|jj	|�}|D]}t|||�s�||fcS|D]}t
||�s�||fcS|j|fS)ahFind 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.
    �=r@z--)r�r�appendr��
get_paramsr�r�)rWrRrSr,rr�r�s       rrVrV%s����S���
�	�
�	�/��Z�@�(�2�2�3�7���a�����D���4��,�S�*�=��{�{�J�&�&�
�[�[�
#�
#�C�
(�F��%�� ��d�E�2��*�$�$�%��%��"�3��.��*�$�$�%��;�;�
�"�"rr))1r�rC�typingr6rr�corerrrrr	r
r�parserr�utilsr
rer8r7r�rr!r�r�r�r<rkr�r��TypeVar�Typer�r�rgrdr9r�r�boolr�r�rir�rUrh�UnionrVr:rr�<module>r�sm��	�	�� �������!�$��#
�	�#
����s�A�E�E�z�*�#
��#
��	#
�
�#
�	�
#
�L"$�"$�L��@*��X��.g�g�T.+�=�.+�bO�-�O�,+�=�+�2�A�I�I�1����
�9N�O��
���9��1�6�6�#�q�v�v�m�4�4�5��59��	��"#�*�*�S�/����((��(��
�
�1�6�6�-�3H�(I�(������t��2"�'�"�#�"�$�"�A�w�A�a�f�f�S�k�A�)�A�PT�A�06�	�6����s�A�E�E�z�*�6��6��&�&��+�	6�

�6�r,#�	�,#����s��,#�14�,#��W�W�Q�W�W�[�)�+�
,�c�
1�2�,#r

Zerion Mini Shell 1.0