
    6                         d 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dlm	Z	 ddl
mZ dd	l
mZ dd
lmZ ddlmZ  G d dej"                        Zy)z:The command to list installed/available gcloud components.    )absolute_import)division)unicode_literals)base)
exceptions)
completers)log)
properties)
console_io)update_managerc                   0    e Zd ZdZdddZed        Zd Zy)Removez9Remove a registered Trusted Test component repository.
  ab            Remove a registered Trusted Tester component repository from the list
          of repositories used by the component manager.  After removing a
          repository, you can run:
            $ gcloud components update
          to revert back to the standard version of any components that were
          installed from that repository.
      z          To be prompted for registered Trusted Tester component repositories to
          remove run:

            $ gcloud components repositories remove
      )DESCRIPTIONEXAMPLESc                 t    | j                  dddt        j                  d       | j                  ddd	       y )
Nurl*URLzZero or more URLs for the component repositories you want to remove.  If none are given, you will be prompted to choose which existing repository you want to remove.)nargsmetavar	completerhelpz--all
store_truez#Remove all registered repositories.)actionr   )add_argumentr   RepoCompleter)parsers    -lib/surface/components/repositories/remove.pyArgszRemove.Args3   sI    
**2  3 B  D    c                    t         j                  j                         }g }|j                  r|j	                  |       g }n|j
                  r|st        j                  d      |j
                  D ]+  }||vst        j                  ddj                  |             |j
                  D ]  }|j                  |        |j	                  |j
                         nq|st        j                  d      t        j                  |dd      }| t        j                  j                  d       n |j!                  |j#                  |             |ret%        j&                  t$        j(                  j*                  j,                  |rdj/                  |      ndt$        j0                  j2                  	       |D ]1  }t        j                  j                  d
j                  |             3 |S )zRuns the remove command.z$You have no registered repositories.r   z0URL [{0}] was not a known registered repository.Nz*Which repository would you like to remove?)defaultmessagezNo repository was removed.,)scopezRemoved repository: [{repo}])repo)r   UpdateManagerGetAdditionalRepositoriesallextendr   NoRegisteredRepositoriesErrorr   InvalidArgumentExceptionformatremover   PromptChoicer	   statusPrintappendpopr
   PersistPropertyVALUEScomponent_manageradditional_repositoriesjoinScopeINSTALLATION)selfargsreposremoved_reposr   resultremoved_repos          r   Runz
Remove.Run@   s   ((BBDEM xx5!e 
::24 	4#e33@GGLN N 
 #S 488$ ::24 	4&&
>@f 


56UYYv./  



-
-
E
E"#((5/  --/
 &	jj5<<,<OP &r    N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   rA    r    r   r   r      s3    

-" 
D 
D-r    r   N)rE   
__future__r   r   r   googlecloudsdk.callioper   r   %googlecloudsdk.command_lib.componentsr   googlecloudsdk.corer	   r
   googlecloudsdk.core.consoler   googlecloudsdk.core.updaterr   SilentCommandr   rH   r    r   <module>rP      s=     A &  ' ( . < # * 2 6NT Nr    