
    +/c                         d Z ddlmZ ddlZddlZddlmZ ddlmZm	Z	 d Z
d Zd	 Zd
 ZddZedk    r eej        dd                    dS dS )z
CLI for conda-token.
    )print_functionN)ArgumentParser   )__version__repo_configc                 0   d t          j                                                    D             }|s:t          d                    t           j                  t          j                   dS |                                D ]\  }}t          ||           dS )z$Default function for list subparser.c                 :    i | ]\  }}|t           j        k    ||S  )r   REPO_URL).0kvs      /lib/python3.11/site-packages/conda_token/cli.py
<dictcomp>ztoken_list.<locals>.<dictcomp>   s+    ]]]tq!1H\C\C\aC\C\C\    z%No tokens have been configured for {}filer   r   )r   
token_listitemsprintformatr   sysstderr)argstokensurltokens       r   r   r      s    ]]{577==??]]]F 5<<[=QRRY\Ycddddqllnn  
Uc51r   c           	      R   	 t          j        | j        | j                   n8# t           j        $ r&}t          |t          j                   Y d }~dS d }~ww xY wt          j        | j        | j	        | j
        | j        | j        | j        | j                   t          d           dS )N)no_ssl_verifyr   r   z@Success! Your token was validated and Conda has been configured.r   )r   validate_tokenr   r   CondaTokenErrorr   r   r   	token_setsystemenvr   include_archive_channelsenable_signature_verification)r   es     r   r"   r"      s    "4:T=OPPPPP&   acj!!!!qqqqq $*dk48TYHe,d.PR R R	
LMMM1s    # AAAc                 ,    t          j                     dS )Nr   )r   token_remove)r   s    r   r)   r)   (   s    1r   c           	         |                      ddt          j        z            }|                                }|                    dddt          j        z             |                    dddt          j        d	d
                              dd          dt          j        d           |                    ddd           dS )zAdd condarc path arguments.zConfig File Location SelectionzAWithout one of these flags, the user config file at '%s' is used.z--system
store_truez*Write to the system .condarc file at '%s'.actionhelpz--envz5Write to the active conda environment .condarc file (CONDA_PREFIXz<no active environment>%z%%z?). If no environment is active, write to the user config file (z).z--filestorezWrite to the given file.N)	add_argument_groupr   escaped_user_rc_pathadd_mutually_exclusive_groupadd_argumentescaped_sys_rc_pathosgetenvreplace)parserconfig_file_location_grouplocations      r   condarc_path_argsr=   -   s    !'!:!:(KkNnn" " *FFHHH9K<[[    
 | >+DEEMMcSWXXXX111	  	 	 	 '      r   c                    t          ddd          }|                    ddddd	t          z  
           |                    d          }|                    dd          }|                    t                     |                    dd          }t          |           |                    t                     |                    dd          }|                    dd           |                    dt          j
        ddd d           |                    ddd           |                    ddd !           t          |           |                    t                     t          t          j                  d"k    rt          j                            d#           |                    |           }|                    |          S )$Nzconda-tokenzconda tokenz6Configure token access for Anaconda Commercial Edition)usagedescriptionz-Vz	--versionversionz-Show the conda-token version number and exit.zconda-token %s)r-   r.   rA   zToken commands)r.   listzList token if configured.)funcremovez)Remove token and revert default_channels.setz.Set your token and configure default_channels.r   zYour token.z--include-archive-channelszcAdd archived channels to default_channels. 
Available channels are mro, mro-archive, free, and pro.+CHANNEL_NAME)choicesr.   nargsdefaultmetavarz--no-ssl-verifyzForce disabling SSL verification. By default conda-token will respect your ssl_verify flag in your Conda settings. Using this flag will add ssl_verify: false to your .condarc file. If not already set.r+   )r.   r-   z--enable-signature-verificationz<Enable Conda package signature verification. Default is off.r,   r   z--help)r   r5   r   add_subparsers
add_parserset_defaultsr   r=   r)   r   ARCHIVE_CHANNELSr"   lenr   argvappend
parse_argsrC   )rQ   r:   	subparsersubparser_listsubparser_removesubparser_setr   s          r   clirX   J   s   M(`b b bF k< ;.	     %%+;%<<I))&7R)SSNZ000 ++H;f+gg&'''!!|!444((5e(ffMw];;;;[Ea&`&)4  Q Q Q 0 8d
 (4  ! ! ! @$b  d d dm$$$I...
38}}!!!T""D99T??r   __main__)N)__doc__
__future__r   r7   r   argparser    r   r   r   r"   r)   r=   rX   __name__rQ   r
   r   r   <module>r_      s     & % % % % % 				 



 # # # # # # & & & & & & & &
 
 

 
 
  
  :* * * *Z zC r   