
    Xf	                     V    d Z ddlZddlZddlZddlZd Z G d dej                  ZdS )z#
Core components for click_plugins
    Nc                       fd}|S )ap  
    A decorator to register external CLI commands to an instance of
    `click.Group()`.

    Parameters
    ----------
    plugins : iter
        An iterable producing one `pkg_resources.EntryPoint()` per iteration.
    attrs : **kwargs, optional
        Additional keyword arguments for instantiating `click.Group()`.

    Returns
    -------
    click.Group()
    c                 &   t          | t          j                  st          d          pdD ]a}	 |                     |                                           +# t          $ r* |                     t          |j                             Y ^w xY w| S )Nz<Plugins can only be attached to an instance of click.Group() )	
isinstanceclickGroup	TypeErroradd_commandload	ExceptionBrokenCommandname)groupentry_pointpluginss     D/var/www/html/env/lib/python3.11/site-packages/click_plugins/core.py	decoratorzwith_plugins.<locals>.decorator   s    %-- 	\Z[[["=b 	C 	CKC!!+"2"2"4"45555 C C C !!-0@"A"ABBBBB	C s   'A1BBr   )r   r   s   ` r   with_pluginsr      s$    $         c                   $    e Zd ZdZd Zd Zd ZdS )r   a^  
    Rather than completely crash the CLI when a broken plugin is loaded, this
    class provides a modified help message informing the user that the plugin is
    broken and they should contact the owner.  If the user executes the plugin
    or specifies `--help` a traceback is reported showing the exception the
    plugin loader encountered.
    c                 t   t           j                            | |           t          j                            t          j        rt          j        d         pt                    }t          j	        
                    d          rd}nd}dt          j                    z   | _        |d|d| j        dz   | _        d	S )
z[
        Define the special help messages after instantiating a `click.Command()`.
        r   CLICK_PLUGINS_HONESTLYu   💩u   †zK
Warning: entry point could not be loaded. Contact its author for help.


z& Warning: could not load plugin. See ` z	 --help`.N)r   Command__init__ospathbasenamesysargv__file__environget	traceback
format_exchelpr   
short_help)selfr   	util_nameicons       r   r   zBrokenCommand.__init__;   s     	tT***G$$SX%=#(1+%IJJ	:>>233 	 DDD+"$$% 		
 Dyy$)))% % 	r   c                 p    t          j        | j        |j                   |                    d           dS )z?
        Print the traceback instead of doing nothing.
        )color   N)r   echor&   r,   exit)r(   ctxs     r   invokezBrokenCommand.invokeR   s0     	
49CI....r   c                     |S )Nr   )r(   r0   argss      r   
parse_argszBrokenCommand.parse_args[   s    r   N)__name__
__module____qualname____doc__r   r1   r4   r   r   r   r   r   1   sK         & & &.      r   r   )r8   r   r   r   r$   r   r   r   r   r   r   <module>r9      s~    
  				 



    ! ! !H+ + + + +EM + + + + +r   