
    c                     z    d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ d Zd	 Zd
 Zd Zd Zd ZdS )z*Commands related to the downloads section.    )absolute_importprint_function)load_project)project_ops)console_utils)prepare_without_interaction)PROVIDE_MODE_CHECKc                     t          |           }t          j        ||||          }|r@t          |j                   t          d|j        j        d|j        j        d           dS t          j	        |           dS )z$Add an item to the services section.)env_spec_nameservice_typevariable_namezAdded service z- to the project file, its address will be in .r      )
r   r   add_serviceprintstatus_descriptionrequirementr   env_varr   print_status_errors)project_dirr   r   r   projectstatuss         Nlib/python3.11/site-packages/anaconda_project/internal/cli/service_commands.pyr   r      s    ;''G$W3@2>3@B B BF  f'(((!...0B0J0J0JL 	M 	M 	Mq)&111q    c                 2   t          |           }|                                5  t          ||t                    }ddd           n# 1 swxY w Y   t	          j        ||||          }|rt          |j                   dS t          j	        |           dS )z)Remove an item from the services section.)r   modeN)r   r   prepare_resultr   r   )
r   null_frontendr   r	   r   remove_servicer   r   r   r   )r   r   r   r   resultr   s         r   r   r   #   s    ;''G 
			 	  l l,WMXjkkkl l l l l l l l l l l l l l l'6C6C7=? ? ?F  f'(((q)&111qs   AAAc                 V   t          |           }t          j        |          rdS |                    |          rLt	          d                    |                      t          j        |                    |          d           n"t	          d                    |                      dS )z(List the services listed on the project.r   zServices for project: {}
title)	name_attrz!No services found for project: {}r   )r   r   print_project_problemsservicesr   formatprint_names_and_descriptionsservice_requirements)r   r   r   s      r   list_servicesr)   6   s    ;''G+G44 q&& G*11+>>???273O3OP]3^3^jqrrrrr188EEFFF1r   c                 N    t          | j        | j        | j        | j                  S )z:Start the add-service command and return exit status code.)r   	directoryenv_specr   variableargss    r   main_addr0   D   s    t~t}d6GWWWr   c                 B    t          | j        | j        | j                  S )z=Start the remove-service command and return exit status code.)r   r+   r,   r-   r.   s    r   main_remover2   I   s    $.$-GGGr   c                 6    t          | j        | j                  S )z@Start the list the services command and return exit status code.)r)   r+   r,   r.   s    r   	main_listr4   N   s    777r   N)__doc__
__future__r   r   *anaconda_project.internal.cli.project_loadr   anaconda_projectr   anaconda_project.internal.clir   anaconda_project.preparer   anaconda_project.provider	   r   r   r)   r0   r2   r4    r   r   <module>r=      s    1 0 6 6 6 6 6 6 6 6 C C C C C C ( ( ( ( ( ( 7 7 7 7 7 7 @ @ @ @ @ @ 7 7 7 7 7 7  "  &  X X X
H H H
8 8 8 8 8r   