U
    d"                     @   sX   d Z ddlZddlmZmZ ejddejedd Zejedejd	d
 Z	dS )zEThe ``celery list bindings`` command, used to inspect queue bindings.    N)CeleryCommandhandle_preload_optionslist)namec                 C   s   dS )z^Get info from broker.

    Note:

        For RabbitMQ the management plugin is required.
    N ctxr   r   3/tmp/pip-unpacked-wheel-mu1yl971/celery/bin/list.pylist_   s    r
   )clsc              	      s    j j}| }|j|  z|j }W n tk
rN   t	
dY nX  fdd}|ddd |ddd |D ]}||d |d	 |d
  qxW 5 Q R X dS )zInspect queue bindings.z$Your transport cannot list bindings.c                    s$    j | dd|dd|  d S )Nz<28 )objZecho)qerr   r   r	   fmt!   s    zbindings.<locals>.fmtQueueZExchangezRouting Keyz----------------ZdestinationsourceZrouting_keyN)r   app
connectionZamqpZTaskConsumerZdeclaremanagerZget_bindingsNotImplementedErrorclickZ
UsageError)r   r   connbindingsr   br   r   r	   r      s    
r   )
__doc__r   Zcelery.bin.baser   r   groupZpass_contextr
   commandr   r   r   r   r	   <module>   s   
	
