HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/click/__pycache__/_bashcomplete.cpython-38.pyc
U

x6�[+�@s�ddlZddlZddlZddlmZddlmZddlmZm	Z	m
Z
ddlmZzddl
mZWnek
r|ddl
ZYnXdZd	Zd
Ze�d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�ZdS)"�N�)�echo)�split_arg_string)�MultiCommand�Option�Argument)�Choice)�abc�=a�
%(complete_func)s() {
    local IFS=$'
'
    COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
                   COMP_CWORD=$COMP_CWORD \
                   %(autocomplete_var)s=complete $1 ) )
    return 0
}

%(complete_func)setup() {
    local COMPLETION_OPTIONS=""
    local BASH_VERSION_ARR=(${BASH_VERSION//./ })
    # Only BASH version 4.4 and later have the nosort option.
    if [ ${BASH_VERSION_ARR[0]} -gt 4 ] || ([ ${BASH_VERSION_ARR[0]} -eq 4 ] && [ ${BASH_VERSION_ARR[1]} -ge 4 ]); then
        COMPLETION_OPTIONS="-o nosort"
    fi

    complete $COMPLETION_OPTIONS -F %(complete_func)s %(script_names)s
}

%(complete_func)setup
a9
%(complete_func)s() {
    local -a completions
    local -a completions_with_descriptions
    local -a response
    response=("${(@f)$( env COMP_WORDS="${words[*]}" \
                        COMP_CWORD=$((CURRENT-1)) \
                        %(autocomplete_var)s="complete_zsh" \
                        %(script_names)s )}")

    for key descr in ${(kv)response}; do
      if [[ "$descr" == "_" ]]; then
          completions+=("$key")
      else
          completions_with_descriptions+=("$key":"$descr")
      fi
    done

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

    if [ -n "$completions" ]; then
        compadd -U -V unsorted -Q -a completions
    fi
    compstate[insert]="automenu"
}

compdef %(complete_func)s %(script_names)s
z
[^a-zA-Z0-9_]cCs@t�d|�dd��}|dkr tnt}|d|||d���dS)N��-�_�zshz_%s_completion)Z
complete_funcZscript_namesZautocomplete_var�;)�_invalid_ident_char_re�sub�replace�COMPLETION_SCRIPT_ZSH�COMPLETION_SCRIPT_BASH�strip)�	prog_name�complete_var�shellZcf_nameZscript�r�5/usr/lib/python3/dist-packages/click/_bashcomplete.py�get_completion_scriptKs�
�rcCs�|j||dd�}|j|j}|r�t|jt�r�|jjst|j�||�\}}}|dkrT|S|j|||dd�}|j|j}q�|r�|j�||�\}}}|dkr�|S|j|||dddd�}|j}qt|}|j|j}qq�q|S)a
    Parse into a hierarchy of contexts. Contexts are connected through the parent variable.
    :param cli: command definition
    :param prog_name: the program that is running
    :param args: full list of args
    :return: the final context/command parsed
    T)�resilient_parsingN)�parentrF)rZallow_extra_argsZallow_interspersed_argsr)Zmake_context�protected_args�args�
isinstance�commandr�chainZresolve_command)�clirr�ctxZcmd_name�cmdZsub_ctxrrr�resolve_ctxUs4
�
�r&cCs|o|dd�dkS)z�
    :param param_str: param_str to check
    :return: whether or not this is the start of an option declaration (i.e. starts "-" or "--")
    Nrrr)Z	param_strrrr�start_of_optionzsr'cCspt|t�sdS|jrdSd}ttdd�|D���D]&\}}|d|jkrLqZt|�r2|}q2|rl||jkrldSdS)aE
    :param all_args: the full original list of args supplied
    :param cmd_param: the current command paramter
    :return: whether or not the last option declaration (i.e. starts "-" or "--") is incomplete and
    corresponds to this cmd_param. In other words whether this cmd_param option can still accept
    values
    FNcSsg|]}|tkr|�qSr)�	WORDBREAK)�.0�argrrr�
<listcomp>�sz(is_incomplete_option.<locals>.<listcomp>rT)r rZis_flag�	enumerate�reversed�nargsr'�opts)�all_args�	cmd_paramZlast_option�indexZarg_strrrr�is_incomplete_option�s
r3cCs^t|t�sdS||j}|dkr$dS|jdkr2dSt|tj�rZ|jdkrZt|�|jkrZdSdS)aL
    :param current_params: the current params and values for this argument as already entered
    :param cmd_param: the current command parameter
    :return: whether or not the last argument is incomplete and corresponds to this cmd_param. In
    other words whether or not the this cmd_param argument can still accept values
    FNT���r)r r�namer.r	�Iterable�len)Zcurrent_paramsr1Zcurrent_param_valuesrrr�is_incomplete_argument�s


��r8csTg}t|jt�r(�fdd�|jjD�}n(|jdk	rP|j||�d�}dd�|D�}|S)a
    :param ctx: context associated with the parsed command
    :param args: full list of args
    :param incomplete: the incomplete text to autocomplete
    :param cmd_param: command definition
    :return: all the possible user-specified completions for the param
    cs"g|]}t|����r|df�qS�N)�str�
startswith�r)�c��
incompleterrr+�s�z,get_user_autocompletions.<locals>.<listcomp>N)r$rr?cSs"g|]}t|t�r|n|df�qSr9)r �tupler<rrrr+�s�)r �typer�choicesZautocompletion)r$rr?r1ZresultsZdynamic_completionsrr>r�get_user_autocompletions�s
�
��rCccs:|j�|�D](}|�|�r|j�||�}|js|VqdS)z�
    :param ctx: context associated with the parsed command
    :starts_with: string that visible commands must start with.
    :return: all visible (not hidden) commands that start with starts_with.
    N)r!Z
list_commandsr;Zget_command�hidden)r$Zstarts_withr=r!rrr�"get_visible_commands_starting_with�s

rEcs|t�jt�r&|�dd�t�|�D���jdk	rx�j�t�jt�r&�jjr&�fdd�t�|�D�}|�dd�|D��q&dS)NcSsg|]}|j|��f�qSr�r5Zget_short_help_strr<rrrr+�sz.add_subcommand_completions.<locals>.<listcomp>csg|]}|j�jkr|�qSr)r5rr<�r$rrr+�s�cSsg|]}|j|��f�qSrrFr<rrrr+�s)r r!r�extendrErr")r$r?Zcompletions_outZremaining_commandsrrGr�add_subcommand_completions�s�
rIcs.t�|��t|||�}|dkr"gSt��rTt�krT��t�}��|d�|d�n�tkr`d�g}t��r�|jjD]J�t	�t
�rt�jst��fdd��j�j
D�}|���fdd�|D��qt|S|jjD] �t���r�t|����Sq�|jjD]"�t|j��r�t|����Sq�t|�|�t|�S)z�
    :param cli: command definition
    :param prog_name: the program that is running
    :param args: full list of args
    :param incomplete: the incomplete text to autocomplete
    :return: all the possible completions for the incomplete
    Nr�rcsg|]}|�ks�jr|�qSr)Zmultiple)r)Z	param_opt)r0�paramrrr+�s�zget_choices.<locals>.<listcomp>cs g|]}|���r|�jf�qSr)r;�help)r)�o)r?rKrrr+�s
)�copy�deepcopyr&r'r(�	partition�appendr!Zparamsr rrDr/Zsecondary_optsrHr3rCr8rI�sorted)r#rrr?r$Zpartition_incompleteZcompletionsZ
param_optsr)r0r?rKr�get_choices�s6


�
rScCs�ttjd�}ttjd�}|d|�}z||}Wntk
rLd}YnXt||||�D],}t|d�|r\t|dr�|dnd�q\dS)NZ
COMP_WORDSZ
COMP_CWORDrrrr
T)r�os�environ�int�
IndexErrorrSr)r#rZinclude_descriptionsZcwordsZcwordrr?�itemrrr�do_completes
rYcCsR|�d�r.|dkrdnd}tt|||��dS|dks>|dkrNt|||dk�SdS)	N�sourceZ
source_zshrZbashTZcompleteZcomplete_zshF)r;rrrY)r#rrZcomplete_instrrrrr�bashcompletes
r[) rNrT�reZutilsr�parserrZcorerrr�typesr�collectionsr	�ImportErrorr(rr�compilerrr&r'r3r8rCrErIrSrYr[rrrr�<module>s2

%
.