
0c@_	  ã               @   sÆ   d  d l  m Z d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z e rŽ d  d l m Z d  d l m Z d	 Z d
 d d d d d i Z Gd d „  d e ƒ Z d S)é    )Úabsolute_importN)ÚCommand)ÚSUCCESS)Úget_prog)ÚMYPY_CHECK_RUNNING)ÚList)ÚValueszD
# pip {shell} completion start{script}# pip {shell} completion end
Úbasha  
        _pip_completion()
        {{
            COMPREPLY=( $( COMP_WORDS="${{COMP_WORDS[*]}}" \
                           COMP_CWORD=$COMP_CWORD \
                           PIP_AUTO_COMPLETE=1 $1 2>/dev/null ) )
        }}
        complete -o default -F _pip_completion {prog}
    ÚzshaM  
        function _pip_completion {{
          local words cword
          read -Ac words
          read -cn cword
          reply=( $( COMP_WORDS="$words[*]" \
                     COMP_CWORD=$(( cword-1 )) \
                     PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ))
        }}
        compctl -K _pip_completion {prog}
    Úfishau  
        function __fish_complete_pip
            set -lx COMP_WORDS (commandline -o) ""
            set -lx COMP_CWORD ( \
                math (contains -i -- (commandline -t) $COMP_WORDS)-1 \
            )
            set -lx PIP_AUTO_COMPLETE 1
            string split \  -- (eval $COMP_WORDS[1])
        end
        complete -fa "(__fish_complete_pip)" -c {prog}
    c               @   s4   e  Z d  Z d Z d Z d d „  Z d d „  Z d S)ÚCompletionCommandz3A helper command to be used for command completion.Tc             C   s›   |  j  j d d d d d d d d d	 d
 ƒ|  j  j d d d d d d d d d	 d ƒ|  j  j d d d d d d d d d	 d ƒ|  j j d |  j  ƒ d  S)Nz--bashz-bÚactionÚstore_constÚconstr	   ÚdestÚshellÚhelpzEmit completion code for bashz--zshz-zr
   zEmit completion code for zshz--fishz-fr   zEmit completion code for fishr   )Úcmd_optsÚ
add_optionÚparserÚinsert_option_group)Úself© r   ú@/tmp/pip-build-jynh7p1z/pip/pip/_internal/commands/completion.pyÚadd_options;   s&    						zCompletionCommand.add_optionsc             C   s®   t  j ƒ  } d d „  t | ƒ Dƒ } | j | k r„ t j t  j | j d ƒ j d t ƒ  ƒ ƒ } t	 t
 j d | d | j ƒ ƒ t St j j d j d j | ƒ ƒ ƒ t Sd	 S)
z-Prints the completion code of the given shellc             S   s   g  |  ] } d  | ‘ q S)z--r   )Ú.0r   r   r   r   ú
<listcomp>V   s   	 z)CompletionCommand.run.<locals>.<listcomp>Ú ÚprogÚscriptr   zERROR: You must pass {}
z or N)ÚCOMPLETION_SCRIPTSÚkeysÚsortedr   ÚtextwrapÚdedentÚgetÚformatr   ÚprintÚBASE_COMPLETIONr   ÚsysÚstderrÚwriteÚjoin)r   ÚoptionsÚargsÚshellsÚshell_optionsr   r   r   r   ÚrunR   s    	zCompletionCommand.runN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Zignore_require_venvr   r1   r   r   r   r   r   6   s   r   )Ú
__future__r   r)   r#   Zpip._internal.cli.base_commandr   Zpip._internal.cli.status_codesr   Zpip._internal.utils.miscr   Zpip._internal.utils.typingr   Ztypingr   Úoptparser   r(   r    r   r   r   r   r   Ú<module>   s"   

	