
    3~h+                         d Z ddlZddlmZ ddlmZmZmZmZ ddlm	Z ddl
m	Z
mZ ddlm	Z ddlmZmZ  G d	 d
e      Zd Z e       Zy)z`
CLI entrypoint & parser configuration.

Builds on top of Invoke's core functionality for same.
    N)Path)Argument
CollectionExitProgram)__version__)r   Agent   )ConfigExecutorc                   f     e Zd Z fdZ fdZed        Z fdZ fdZd Z	 fdZ
 fdZ xZS )	Fabc                     t         |           t        dj                  t                     t        dj                  t
                     y )NzParamiko {}z	Invoke {})superprint_versionprintformatparamikoinvokeself	__class__s    T/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/fabric/main.pyr   zFab.print_version   s4    m""8,-k  ()    c                    t         |          }t        dd      t        dt        d      t        dt        d      t        d	t        d
      t        dt        d      t        dd      t        dt
        d      g}||z   S )N)Hhostsz6Comma-separated host name(s) to execute tasks against.)nameshelp)iidentityzEPath to runtime SSH identity (key) file. May be given multiple times.)r   kindr   )list-agent-keysz%Display ssh-agent key list, and exit.)prompt-for-login-passwordz,Request an upfront SSH-auth password prompt.)prompt-for-passphrasez-Request an upfront SSH key passphrase prompt.)S
ssh-configz Path to runtime SSH config file.)tconnect-timeoutz1Specifies default connection timeout, in seconds.)r   	core_argsr   listboolint)r   r*   my_argsr   s      r   r*   zFab.core_args   s    G%'	$M ' ] *< 4C
 0D
 )7 .HA%
L 7""r   c                     | j                   j                   xr9 | j                   j                  xr! | j                  j                  j
                   S N)coreunparsed	remainderargscompletevaluer   s    r   _remainder_onlyzFab._remainder_onlyB   sF     		""" -		##-II&&,,,	
r   c                 Z    | j                   rt               | _        y t        |           y r0   )r8   r   
collectionr   load_collectionr   s    r   r;   zFab.load_collectionO   s$     
 )lDOG#%r   c                 <    | j                   st        | 	          y y r0   )r8   r   no_tasks_givenr   s    r   r=   zFab.no_tasks_given_   s     ##G"$ $r   c                     | j                  d      | _        | j                  j                          | j                  j                          y )NT)lazy)config_classconfigload_base_conf_filesmerger7   s    r   create_configzFab.create_confige   s=     ''T'2 	((* 	r   c                    t         |   d       | j                  j                  | j                  d   j
                         | j                  j                          i }| j                  d   j
                  }|r?||d<   t        |D cg c]  }t        |       c}      | j                  j                  d<   | j                  d   j
                  }|r||d	<   | j                  d
   j
                  rd}t        j                  |      |d<   | j                  d   j
                  rd}t        j                  |      |d<   || j                  j                  d<   | j                  j                          y c c}w )NF)rC   r'   r!   key_filename)
identitiesauthenticationr)   timeoutr$   z,Enter login password for use with SSH auth: passwordr%   z-Enter passphrase for use unlocking SSH keys: 
passphraseconnect_kwargs)r   update_configrA   set_runtime_ssh_pathr4   r6   load_ssh_configdictr   
_overridesgetpassrC   )r   rL   pathsxrI   promptr   s         r   rM   zFab.update_configu   sG    	E*((<)@)F)FG##% 		*%++-2N>* 8<-23DG38DKK""#34 ))-.44(/N9% 990177CF)0)@N:&99,-33DF+2??6+BN<( 4B/0 	3 4s   	E4c           	      6   t        |   |i | | j                  d   j                  rpt	               j                         }|D ]M  }d}t        |j                  |j                         |j                  |j                  |j                               O t        y )Nr#   z{} {} {} ({}))r   
parse_corer4   r6   r	   get_keysr   r   get_bitsfingerprintcommentalgorithm_namer   )r   r4   kwargskeyskeytplr   s         r   rW   zFab.parse_core   s    D+F+99&'--7##%D % JJ**		 J .r   )__name__
__module____qualname__r   r*   propertyr8   r;   r=   rD   rM   rW   __classcell__)r   s   @r   r   r      sA    *
(#T 

 

& % *^ r   r   c                  8    t        dt        t        t              S )NFabric)nameversionexecutor_classr@   )r   fabricr   r    r   r   make_programrm      s    	 r   )__doc__rR   pathlibr   r   r   r   r   r   r   r   r	    rk   r   r   r   rm   programrl   r   r   <module>rr      sA      6 6 ( 3 # b' bL .r   