o
    Ê`
bo  ã                   @   s.  d dl Z d dlZd dlZd dlmZmZ dddgiZd0dd„Zd0d	d
„Z	d0dd„Z
ejed�e ¡ dd„ ƒƒZejedd�ejdddd�ejdddde eeƒ¡d d eeƒ¡¡d�ejddddd�ejdd d!�ejd"d#dd$d�ejd%d&dd'd�d(d)„ ƒƒƒƒƒƒƒZejed*d�ejdddd�ejdddde eeƒ¡d d eeƒ¡¡d�ejddddd�ejdd d!�ejd"d#dd$d�ejd%d&dd'd�d+d,„ ƒƒƒƒƒƒƒZejed-d�ejdddd�ejdddde eeƒ¡d d eeƒ¡¡d�ejddddd�ejdd d!�ejd%d&dd'd�d.d/„ ƒƒƒƒƒƒZdS )1é    N)ÚDEFAULT_SHELLSÚSHELLSÚhelp_option_namesz-hz--helpTc                 C   ó   t j| dd|d� d S )NÚcyanT©ÚfgÚboldÚnl©ÚclickÚsecho©Útextr
   © r   ú./usr/lib/python3/dist-packages/userpath/cli.pyÚecho_success   ó   r   c                 C   s   t j| dd|dd� d S )NÚredT)r   r	   r
   Úerrr   r   r   r   r   Úecho_failure   s   r   c                 C   r   )NÚyellowTr   r   r   r   r   r   Úecho_warning   r   r   )Úcontext_settingsc                   C   s   d S )Nr   r   r   r   r   Úuserpath   s   r   zPrepends to the user PATH)r   Ú
short_helpÚ	locationséÿÿÿÿ)ÚrequiredÚnargsz-sz--shellÚshellsz†The shell in which PATH will be modified. This can be selected multiple times and has no effect on Windows. The default shells are: {}z, )ÚmultipleÚtypeÚhelpz-az--all-shellsznUpdate PATH of all supported shells. This has no effect on Windows as environment settings are already global.)Úis_flagr#   z--homez"Explicitly set the home directory.)r#   z-fz--forcez-Update PATH even if it appears to be correct.z-qz--quietz+Suppress output for successful invocations.c              
   C   óÆ   |s.| D ])}t  |¡rtd |¡ƒ t d¡ qt j||||d�r-td |¡ƒ t d¡ qzt j| |||dd� W n tyX } zt	t
|ƒƒ t d¡ W Y d}~dS d}~ww |satd	ƒ dS dS )
z^Prepends to the user PATH. The shell must be restarted for the update to
    take effect.
    úoThe directory `{}` is already in PATH! If you are sure you want to proceed, try again with the -f/--force flag.é   ©r    Ú
all_shellsÚhomeúˆThe directory `{}` is already in PATH, pending a shell restart! If you are sure you want to proceed, try again with the -f/--force flag.T©r    r)   r*   Úchecké   NúSuccess!)ÚupÚin_current_pathr   ÚformatÚsysÚexitÚin_new_pathÚprependÚ	Exceptionr   Ústrr   ©r   r    r)   r*   ÚforceÚquietÚlocationÚer   r   r   r6      ó2   
ýý
€€þÿr6   zAppends to the user PATHc              
   C   r%   )
z]Appends to the user PATH. The shell must be restarted for the update to
    take effect.
    r&   r'   r(   r+   Tr,   r.   Nr/   )r0   r1   r   r2   r3   r4   r5   Úappendr7   r   r8   r   r9   r   r   r   r?   U   r>   r?   z(Checks if locations are in the user PATHc                 C   sp   | D ]3}t  |¡r|std |¡ƒ qt j||||d�r)td |¡ƒ t d¡ qtd |¡ƒ t d¡ qdS )z)Checks if locations are in the user PATH.zThe directory `{}` is in PATH!r(   z7The directory `{}` is in PATH, pending a shell restart!r'   z"The directory `{}` is not in PATH!r.   N)	r0   r1   r   r2   r5   r   r3   r4   r   )r   r    r)   r*   r;   r<   r   r   r   ÚverifyŒ   s   
€÷r@   )T)r3   r   r   r0   Úuserpath.shellsr   r   ÚCONTEXT_SETTINGSr   r   r   ÚgroupÚversion_optionÚcommandÚargumentÚoptionÚChoiceÚsortedr2   Újoinr6   r?   r@   r   r   r   r   Ú<module>   s’    



øûøûøû