
                             d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ d
Z G d dej                        Zy)zAA calliope command that prints help for another calliope command.    )absolute_import)division)unicode_literalsN)base)search)search_util)log   c                   D    e Zd ZdZej
                  Zed        Zd Z	d Z
y)Helpa  Search gcloud help text.

  If a full gcloud command is specified after the ``help'' operand, {command}
  prints a detailed help message for that command.

  Otherwise, {command} runs a search for all commands with help text matching
  the given argument or arguments. It prints the command name and a summary of
  the help text for any command that it finds as a result.

  To run a search directly, you can use remainder arguments, following a `--`.

  By default, command results are displayed in a table that shows the name
  of the command and snippets of the help text that relate to your search terms.

  By default, search results are sorted from most to least relevant by default,
  using a localized rating based on several heuristics. These heuristics may
  change in future runs of this command.

  ## EXAMPLES

  To get the help for the command `gcloud projects describe`, run:

    $ {command} projects describe

  To search for all commands whose help text contains the word `project`, run:

    $ {command} -- project

  To search for commands whose help text contains the word `project` and the
  string `--foo`, run:

    $ {command} -- project --foo

  To search and receive more than the default limit of 5 search results, run:

    $ {command} --limit=20 -- project

  To search for a term and sort the results by a different characteristic, such
  as command name, run:

    $ {command} --sort-by=name -- project
  c                    | j                   j                  t        j                                | j                   j	                  d       t
        j                  j                  |        t
        j                  j                  | t               t
        j                  j                  | d       | j                  ddd       | j                  dt        j                  d       y )	Nzn
        table[all-box,pager](
            commandpath():label='COMMAND',
            summary():wrap)
        z
~relevancecommand*a  Sequence of names representing a gcloud group or command name.

If the arguments provide the name of a gcloud command, the full help
text of that command will be displayed. Otherwise, all arguments will
be considered search terms and used to search through all of gcloud's
help text.
)nargshelpsearch_termsan  Search terms. The command will return a list of gcloud commands that are
relevant to the searched term. If this argument is provided, the command
will always return a list of search results rather than displaying help
text of a single command.

For example, to search for commands that relate to the term `project` or
`folder`, run:

  $ {command} -- project folder
)display_infoAddTransformsr   GetTransforms	AddFormatr   URI_FLAGRemoveFromParser
LIMIT_FLAG
SetDefault_DEFAULT_LIMITSORT_BY_FLAGadd_argumentargparse	REMAINDER)parsers    lib/surface/help.pyArgsz	Help.ArgsO   s    
%%k&?&?&AB
!! # 
 	MM""6*OOv~6  6
  
   
      c                 \   |j                   s!	 | j                  |j                  dgz          y t	        j
                  |j                  |j                   xs g z   | j                        }t        |      | _        t        t        |      |j                        | _        |S # t        $ r Y |w xY w)Nz--document=style=help)r   ExecuteCommandDoNotUser   	Exceptionr   	RunSearch_cli_power_users_onlylen_resources_foundminlimit_resources_displayed)selfargsresultss      r!   RunzHelp.Runu   s     	##DLL4K3L$LM
 ))/R0""$G  LD #CL$** =DN  s   B 	B+*B+c                     | j                   sy |rDt        j                  j                  dj	                  | j
                  | j                                y t        j                  j                  d       y )NzListed {} of {} items.zListed 0 items.)r*   r	   statusPrintformatr-   )r.   resources_were_displayeds     r!   EpilogzHelp.Epilog   sY      	jj
"
)
)$*C*C*.*?*?AB 
jj()r#   N)__name__
__module____qualname____doc__r   SDK_TOOLS_CATEGORYcategorystaticmethodr"   r1   r7    r#   r!   r   r   !   s2    )V $$(# #J&*r#   r   )r;   
__future__r   r   r   r   googlecloudsdk.callioper   &googlecloudsdk.command_lib.help_searchr   r   googlecloudsdk.corer	   r   ListCommandr   r?   r#   r!   <module>rE      s>     H &  '  ( 9 > # o*4 o*r#   