ó
žS]c           @@ sĶ   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(   s*   Commands related to the downloads section.i    (   t   absolute_importt   print_function(   t   load_project(   t   project_ops(   t   console_utils(   t   prepare_without_interaction(   t   PROVIDE_MODE_CHECKc         C@ sy   t  |   } t j | d | d | d | } | rd t | j  t d | j j | j j f  d St j	 |  d Sd S(   s$   Add an item to the services section.t   env_spec_namet   service_typet   variable_names@   Added service %s to the project file, its address will be in %s.i    i   N(
   R   R   t   add_servicet   printt   status_descriptiont   requirementR   t   env_varR   t   print_status_errors(   t   project_dirR   R   R	   t   projectt   status(    (    sM   lib/python2.7/site-packages/anaconda_project/internal/cli/service_commands.pyR
      s    c      
   C@ s   t  |   } | j    t | d | d t } Wd QXt j | d | d | d | } | ro t | j  d St j	 |  d Sd S(   s)   Remove an item from the services section.R   t   modeNR	   t   prepare_resulti    i   (
   R   t   null_frontendR   R   R   t   remove_serviceR   R   R   R   (   R   R   R	   R   t   resultR   (    (    sM   lib/python2.7/site-packages/anaconda_project/internal/cli/service_commands.pyR   !   s    c         C@ sw   t  |   } t j |  r d S| j |  r` t d j |    t j | j |  d d n t d j |    d S(   s(   List the services listed on the project.i   s   Services for project: {}
t	   name_attrt   titles!   No services found for project: {}i    (   R   R   t   print_project_problemst   servicesR   t   formatt   print_names_and_descriptionst   service_requirements(   R   R   R   (    (    sM   lib/python2.7/site-packages/anaconda_project/internal/cli/service_commands.pyt   list_services2   s    c         C@ s   t  |  j |  j |  j |  j  S(   s:   Start the add-service command and return exit status code.(   R
   t	   directoryt   env_specR   t   variable(   t   args(    (    sM   lib/python2.7/site-packages/anaconda_project/internal/cli/service_commands.pyt   main_add@   s    c         C@ s   t  |  j |  j |  j  S(   s=   Start the remove-service command and return exit status code.(   R   R    R!   R"   (   R#   (    (    sM   lib/python2.7/site-packages/anaconda_project/internal/cli/service_commands.pyt   main_removeE   s    c         C@ s   t  |  j |  j  S(   s@   Start the list the services command and return exit status code.(   R   R    R!   (   R#   (    (    sM   lib/python2.7/site-packages/anaconda_project/internal/cli/service_commands.pyt	   main_listJ   s    N(   t   __doc__t
   __future__R    R   t*   anaconda_project.internal.cli.project_loadR   t   anaconda_projectR   t   anaconda_project.internal.cliR   t   anaconda_project.prepareR   t   anaconda_project.provideR   R
   R   R   R$   R%   R&   (    (    (    sM   lib/python2.7/site-packages/anaconda_project/internal/cli/service_commands.pyt   <module>   s   					