示例#1
0
 def Args(parser):
     cache_util.AddCacheFlag(parser)
     parser.add_argument(
         '--qualify',
         metavar='NAME',
         type=arg_parsers.ArgList(),
         help=(
             'A list of resource parameter names that must always be '
             'qualified. This is a manual setting for testing. The CLI sets '
             'this automatically.'))
     parser.add_argument(
         '--kwargs',
         metavar='NAME=VALUE',
         type=arg_parsers.ArgDict(),
         help=('Keyword arg dict passed to the completer constructor. For '
               'example, use this to set the resource collection and '
               'list command for `DeprecatedListCommandCompleter`:\n\n'
               '  --kwargs=collection=...,foo="..."'))
     parser.add_argument(
         '--stack-trace',
         action='store_true',
         default=True,
         help=(
             'Enable all exception stack traces, including Cloud SDK core '
             'exceptions.'))
     parser.AddDynamicPositional(
         'module_path',
         action=AddCompleterResourceFlags,
         help=
         ('The completer module path. Run $ gcloud meta completers list` '
          'to list the avilable completers. A completer module may declare '
          'additional flags. Specify `--help` after _MODULE_PATH_ '
          'for details on the module specific flags.'))
示例#2
0
 def Args(parser):
   cache_util.AddCacheFlag(parser)
   parser.add_argument(
       'tables',
       nargs='*',
       help=('The table names or name patterns to delete, where `?` matches '
             'any character and ```*``` matches any string of zero or more '
             'characters. If omitted then the entired cache is deleted.'))
示例#3
0
 def Args(parser):
   cache_util.AddCacheFlag(parser)
   parser.add_argument(
       'tables',
       nargs='*',
       help=('The table names or name patterns to list, where `?` matches any '
             'character and ```*``` matches any string of zero or more '
             'characters. If omitted then a table of all tables is '
             'displayed.'))
示例#4
0
 def Args(parser):
   # Add a concept handler that will be stuffed dynamically with information.
   concept_parsers.ConceptParser([]).AddToParser(parser)
   parser.add_argument(
       '--resource-spec-path',
       help=('The resource spec path for a resource argument auto-generated '
             'completer.'))
   parser.add_argument(
       '--attribute',
       help=('The name of the resource attribute for a resource argument '
             'auto-generated completer.'))
   parser.add_argument(
       '--resource-presentation-kwargs',
       type=arg_parsers.ArgDict(
           spec={
               'name': str,
               'flag_name_overrides': str,
               'plural': bool,
               'prefixes': bool,
               'required': bool}),
       help=('Dict of kwargs to be passed to the presentation spec for the '
             'resource argument for which a completer is being tested, such '
             'as name, prefixes, plural, flag name overrides (format as a '
             'list of semicolon-separated key:value pairs). Prefixes is False '
             'by default. Name is the resource spec name by default.'))
   cache_util.AddCacheFlag(parser)
   parser.add_argument(
       '--qualify',
       metavar='NAME',
       type=arg_parsers.ArgList(),
       help=('A list of resource parameter names that must always be '
             'qualified. This is a manual setting for testing. The CLI sets '
             'this automatically.'))
   parser.add_argument(
       '--kwargs',
       metavar='NAME=VALUE',
       type=arg_parsers.ArgDict(),
       help=('Keyword arg dict passed to the completer constructor. For '
             'example, use this to set the resource collection and '
             'list command for `DeprecatedListCommandCompleter`:\n\n'
             '  --kwargs=collection=...,foo="..."'))
   parser.add_argument(
       '--stack-trace',
       action='store_true',
       default=True,
       help=('Enable all exception stack traces, including Cloud SDK core '
             'exceptions.'))
   parser.AddDynamicPositional(
       'module_path',
       action=AddCompleterResourceFlags,
       help=('The completer module path. Run $ gcloud meta completers list` '
             'to list the module paths of the available completers. A '
             'completer module may declare additional flags. Specify `--help` '
             'after _MODULE_PATH_ for details on the module specific flags.'
             '\n\nNOTE: To test resource argument completers, use the '
             'module path "googlecloudsdk.command_lib.util.completers:'
             'CompleterForAttribute". The flags `--resource-spec-path`, '
             '`--attribute`, and (if desired) `--resource-presentation-'
             'kwargs` must be provided BEFORE the positional. Unlike with '
             'most gcloud commands, the arguments are generated on the fly '
             'using the completer you provide, so all the information to '
             'create a resource completer needs to be provided up-front. For '
             'example:\n\n  $ {command} --resource-spec-path MODULE_PATH:'
             'SPEC_OBJECT --attribute ATTRIBUTE_NAME --resource-presentation-'
             'kwargs flag_name_overrides=ATTRIBUTE1:FLAG1;ATTRIBUTE2:FLAG2 '
             'googlecloudsdk.command_lib.util.completers:CompleterForAttribute'
            ))