
    B/g                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSrSr	Sr
\R                  " \ \R                  S9r\R                  SSS	S
S9  \R                  SSS9  \R                  SSS
S9  \R                  " \5        SqS rS rS rS rS rS rS rS rSS jrS rS rS rS r\S:X  a  \R>                  " \" 5       5        gg) zm
Activate the generic bash-completion script or zsh completion autoload function for the argcomplete module.
    Nzargcomplete.scriptsz_
# Begin added by argcomplete
fpath=( {zsh_fpath} "${{fpath[@]}}" )
# End added by argcomplete
zN
# Begin added by argcomplete
source "{activator}"
# End added by argcomplete
)descriptionformatter_classz-yz--yesz*automatically answer yes for all questions
store_true)helpactionz--destzQSpecify the shell completion modules directory to install into, or "-" for stdout)r   z--userzInstall into user directoryc                       [         R                  " SS/5      R                  5       R                  5       $ ! [        [         R
                  4 a     gf = f)Nbrewz--prefixz
/usr/local)
subprocesscheck_outputdecodestripFileNotFoundErrorCalledProcessError     X/usr/lib/python3/dist-packages/argcomplete/scripts/activate_global_python_argcomplete.pyget_local_dirr   +   sL    &&
';<CCEKKMMz<<= s   36 AAc                      [        5        S3$ )Nz/share/zsh/site-functions)r   r   r   r   get_zsh_system_dirr   2   s    o788r   c                      S[         R                  ;   a  [         R                  S   $ [        R                  S:X  a  [	        5        S3$ g)NBASH_COMPLETION_COMPAT_DIRdarwinz/etc/bash_completion.d)osenvironsysplatformr   r   r   r   get_bash_system_dirr   6   s>    #rzz1zz677		!/""899'r   c                      [         R                  R                  [         R                  R                  [         R                  R	                  [
        R                  5      5      S5      $ )Nzbash_completion.d)r   pathjoinabspathdirnameargcomplete__file__r   r   r   get_activator_dirr%   ?   s8    77<<8L8L(MNPcddr   c                  R    [         R                  R                  [        5       S5      $ )Nz_python-argcomplete)r   r   r    r%   r   r   r   get_activator_pathr'   C   s    77<<)+-BCCr   c                    [        5       nU S:X  aB  [        U5       n[        R                  R	                  UR                  5       5        S S S 5        g [        R                  R                  U 5      n[        R                  R                  U5      (       d   [        R                  " USS9   [        SU SU  S3[        R                  S	9  [         R"                  " X5        [        S
[        R                  S	9  g ! , (       d  f       g = f! [         a%  n[        R                  SU SU 35         S nANS nAff = f! [         a&  n[        R                  SU  SU S35         S nAg S nAff = f)N-T)exist_okzpath z* does not exist and could not be created: zInstalling z to ...filez
Installed.zwhile installing to z: zE. Please run this command using sudo, or see --help for more options.)r'   openr   stdoutwritereadr   r   r"   existsmakedirs	Exceptionparsererrorprintstderrshutilcopy)dest	activatorfhdestdires        r   install_to_destinationr@   G   s!   "$Is{)_JJRWWY' ggood#G77>>'""	YKK$/
I;d4&43::FI$l, _
  	YLL5	)STUSVWXX	Y  
"4&1#-rs	
 	

s<   .C;D -AD> ;
D	
D;D66D;>
E.E))E.c                      [         c   e[         R                  SL a  g [        S5      n U R                  5       S;  a  [	        S[
        R                  S9  OU R                  5       S;   a  ggMP  )NTzOK to proceed? [y/n] >   nynoyeszPlease answer "yes" or "no".r,   >   rC   rE   F)argsrE   inputlowerr7   r   r8   )ress    r   get_consentrJ   ]   sb    xx4
+,99;550szzBYY[L( r   c                    [         R                  R                  U 5      (       a  [        U S5       nXR	                  5       ;   a&  [        SU  S3[        R                  S9   S S S 5        g  S S S 5        [        SU  S3[        R                  S9  UR                  5        H  n[        SU[        R                  S9  M     [        5       (       d  [        S[        R                  S9  g [        S	U  S
3[        R                  S9  [        U S5       nUR                  U5        S S S 5        [        S[        R                  S9  g ! , (       d  f       N= f! , (       d  f       N8= f)Nrz$The code already exists in the file .r,   z(argcomplete needs to append to the file z&. The following code will be appended:>z
Not added.zAdding shellcode to r+   azAdded.)r   r   r2   r.   r1   r7   r   r8   
splitlinesrJ   r0   )r   	shellcoder=   lines       r   append_to_config_filerS   k   s   	ww~~d$_GGI%<TF!D3::V _%  	8>delolvlvw((*D#t#**- +}},SZZ0	 c
*<	dCB
 
	($ _ 
s   1EE
E
E"c                    [         R                  R                  [         R                  R                  [         R                  R                  SS5      5      S5      n[        U[        R                  U =(       d
    [        5       S95        g )NZDOTDIR~z.zshenv	zsh_fpath)
r   r   r    
expanduserr   getrS   zsh_shellcodeformatr%   )rX   
zsh_rcfiles     r   link_zsh_user_rcfiler^   }   sV    bgg00	31OPR[\J*m&:&:YEeRcRe&:&fgr   c                      [         R                  R                  S5      n [        U [        R                  [        5       S95        g )Nz~/.bash_completion)r<   )r   r   rY   rS   bash_shellcoder\   r'   )bash_completion_user_files    r   link_bash_user_rcfilerb      s5     " 2 23G H3^5J5JUgUi5J5jkr   c                  ,    [        5         [        5         g N)r^   rb   r   r   r   link_user_rcfilesre      s    r   c                  b   S[         R                  R                  SS5      ;  a  g  [        5       n [        R
                  " [         R                  S   SS/5      nUR                  5       R                  5        H
  nX :X  d  M
    g    [        U S9  g ! [        [        R                  4 a     g f = f)NzshSHELL z-czprintf "%s
" "${fpath[@]}"rW   )r   r   rZ   r   r
   r   r   rP   r^   r   r   )zsh_system_dirfpath_outputfpaths      r   $add_zsh_system_dir_to_fpath_for_userrm      s    BJJNN7B//+-!..

70CTKh/ij!((*557E& 8 	~6z<<= s   AB B B B.-B.c                  N   [         R                  5       q/ n [        R                  (       a  [        R                  S:w  aY  [        R
                  R                  [        R                  5      (       d'  [         R                  S[        R                   S35        U R                  [        R                  5        GO$[        R                  (       aZ  [        R                  (       aE  [        R                  [        R                  ;   a#  [        S[        R                   S9  [#        5         O[        R$                  [        R&                  :w  a#  [        S[        R                   S9  [#        5         Op[        R(                  (       a  [#        5         OP[        S[        R                   S9  U R                  [+        5        S35        U R                  [-        5        S	35        U  H  n[/        U5        M     [1        5         [        R                  c  [        S
[        R                   S9  g g )Nr)   z
directory z0 was specified via --dest, but it does not existz\Argcomplete was installed in the user site local directory. Defaulting to user installation.r,   zTArgcomplete was installed in a virtual environment. Defaulting to user installation.z'Defaulting to system-wide installation.z/_python-argcompletez/python-argcompletezFPlease restart your shell or source the installed file to activate it.)r5   
parse_argsrF   r;   r   r   r2   r6   appendsiteENABLE_USER_SITE	USER_SITEr#   r$   r7   r   r8   re   prefixbase_prefixuserr   r   r@   rm   )destinationsdestinations     r   mainry      sY   DLyy99BGGNN499$=$=LL:dii[0`abDII&			4>>dnnH\H\6\j	
 		s	&dknkukuv	7cjjI1344HIJ2455HIJ#{+ $ )*yyV]`]g]gh r   __main__rd   ) __doc__argparser   r9   rq   r
   r   r#   __package__r[   r`   ArgumentParserRawDescriptionHelpFormatterr5   add_argumentautocompleterF   r   r   r   r%   r'   r@   rJ   rS   r^   rb   re   rm   ry   __name__exitr   r   r   <module>r      s
    	    
  $ 
	 	 WhFjFj	k   D'(T]i  j   H#v  w   H#@  V     9(eD
,%$h
l
 iF zHHTV r   