
    
                         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  G d
 dej                        Zy)zThe Browse command.    )absolute_import)division)unicode_literals)base)browser_dispatcher)flags)log)
propertiesc                   .    e Zd ZdZddiZed        Zd Zy)Browsez)Open the specified versions in a browser.EXAMPLESab            To show version `v1` for the default service in the browser, run:

              $ {command} v1

          To show version `v1` of a specific service in the browser, run:

              $ {command} v1 --service="myService"

          To show multiple versions side-by-side, run:

              $ {command} v1 v2 --service="myService"
          c                     | j                   j                  d       t        j                  j	                  |        | j                  ddd       | j                  ddd	       y )
Nz_
          table(
            version:label=VERSION,
            url:label=URL
          )
    versions+zI        The versions to open (optionally filtered by the --service flag).)nargshelpz	--servicez-szcIf specified, only open versions from the given service. If not specified, use the default service.)r   )display_info	AddFormatr   LAUNCH_BROWSERAddToParseradd_argument)parsers    "lib/surface/app/versions/browse.pyArgszBrowse.Args1   so    
!! # 	 
$$V,
M  N
 T1  3    c           	      x   t         j                  j                  j                  j	                  d      }g }|j
                  D ]=  }|j                  t        j                  ||j                  ||j                               ? t        |      r-|j                  rt        j                  j                  d       |S y)z5Launch a browser, or return a table of URLs to print.T)requiredz@Did not detect your browser. Go to these links to view your app:N)r
   VALUEScoreprojectGetr   appendr   	BrowseAppservicelaunch_browseranyr	   statusPrint)selfargsr    outputsversions        r   Runz
Browse.RunD   s    $$,,00$0?GG==nn'11'26,,29262E2EG H !
 7|			

N	Pnr   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r-    r   r   r   r      s/    1  -  3 3$r   r   N)r1   
__future__r   r   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.appr   r   googlecloudsdk.corer	   r
   Commandr   r4   r   r   <module>r:      s4      '  ' ( = 0 # *5T\\ 5r   