|
Server : LiteSpeed System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : elvh3918 ( 1528) PHP Version : 8.2.31 Disable Function : mail Directory : /usr/local/lib/python3.9/site-packages/click_repl/__pycache__/ |
a
��Sh� � @ s� d dl Z d dlZd dlZd dlZd dlmZ ddlmZmZ g d�Z ej
dkr`d dlmZm
Z
nd dlmZm
Z
d!dd �Zi Zd"dd�Zd#d
d�Zd$dd�Zdd� Zdd� Zeg d�ed� eg d�ed� d%dd�Zdd� Zdd� Zdd � ZdS )&� N)�defaultdict� )�CommandLineParserError�ExitReplException)
�_execute_internal_and_sys_cmds�_exit_internal�_get_registered_target�_help_internal�_resolve_context�_register_internal_command�dispatch_repl_commands�handle_internal_commands�split_arg_string�exit)� r )�Iterable�Mappingc C s� | r�|j }t|tj�r�|jsZ|�|| �\}}} |du r:|S |j|| |dd�}|j|j } q�| r�|�|| �\}}} |du r||S |j|| |dddd�}|j} qZ|}g |j�|j�} q q�q |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 args: List of complete args before the incomplete value.
:param cli_ctx: `click.Context` object of the CLI group
NT)�parent�resilient_parsingF)r Zallow_extra_args�allow_interspersed_argsr ) �command�
isinstance�clickZMultiCommand�chainZresolve_commandZmake_contextZprotected_args�args)r �ctxr �name�cmdZsub_ctx� r �:/usr/local/lib/python3.9/site-packages/click_repl/utils.pyr
s4 �r
Tc C sZ t j | |d�}d|_d|_g }z|D ]}|�|� q$W n tyT |�|j� Y n0 |S )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.
)�posixT� )�shlex�whitespace_split�
commenters�append�
ValueError�token)�stringr �lex�outr'