o
    Œ¨Êh  ã                   @   sV   d Z ddlZddlZddlZG dd„ dƒZG dd„ deejƒZG dd„ deejƒZdS )	zT
Extension for ``click`` to provide a group
with a git-like *did-you-mean* feature.
é    Nc                
       st   e Zd ZdZdejdejddf‡ fdd„Zdejdej	e
 dejeje
 ejej ej	e
 f f‡ fd	d
„Z‡  ZS )ÚDYMMixinz¡
    Mixin class for click MultiCommand inherited classes
    to provide git-like *did-you-mean* functionality when
    a certain command is not registered.
    ÚargsÚkwargsÚreturnNc                    s2   |  dd¡| _|  dd¡| _tƒ j|i |¤Ž d S )NÚmax_suggestionsé   Úcutoffg      à?)Úpopr   r   ÚsuperÚ__init__)Úselfr   r   ©Ú	__class__© úK/var/www/html/env/lib/python3.10/site-packages/click_didyoumean/__init__.pyr      s   zDYMMixin.__init__Úctxc              
      s˜   z
t t| ƒ ||¡W S  tjjyK } z3t|ƒ}tj |d ¡}t	 
||  |¡| j| j¡}|r?d |¡}|d7 }|d|› �7 }tj ||j¡‚d}~ww )z™
        Overrides clicks ``resolve_command`` method
        and appends *Did you mean ...* suggestions
        to the raised exception message.
        r   z
    z

zDid you mean one of these?
    N)r
   r   Úresolve_commandÚclickÚ
exceptionsÚ
UsageErrorÚstrÚutilsÚmake_strÚdifflibÚget_close_matchesÚlist_commandsr   r   Újoinr   )r   r   r   ÚerrorÚ	error_msgÚoriginal_cmd_nameÚmatchesÚfmt_matchesr   r   r   r      s$   
ü
€òzDYMMixin.resolve_command)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚtypingÚAnyr   r   ÚContextÚListr   ÚTupleÚOptionalÚCommandr   Ú__classcell__r   r   r   r   r      s    ÿÿÿþr   c                   @   ó   e Zd ZdZdS )ÚDYMGroupz€
    click Group to provide git-like
    *did-you-mean* functionality when a certain
    command is not found in the group.
    N©r"   r#   r$   r%   r   r   r   r   r/   5   ó    r/   c                   @   r.   )ÚDYMCommandCollectionzŒ
    click CommandCollection to provide git-like
    *did-you-mean* functionality when a certain
    command is not found in the group.
    Nr0   r   r   r   r   r2   =   r1   r2   )	r%   r   r&   r   r   ÚGroupr/   ÚCommandCollectionr2   r   r   r   r   Ú<module>   s    )