Exemplo n.º 1
0
 def Run(self, args):
     if not args.IsSpecified('sort_by'):
         args.sort_by = ['module_path', 'collection', 'api_version']
     with progress_tracker.ProgressTracker(
             'Collecting attached completers from all command flags and arguments'
     ):
         return cache_util.ListAttachedCompleters(
             self._cli_power_users_only)
Exemplo n.º 2
0
    def testListAttachedCompleters(self):
        completers = cache_util.ListAttachedCompleters(self.cli)
        resource_printer.Print(sorted(completers, key=_GetSortKey),
                               print_format='json')
        self.AssertOutputContains("""\
[
  {
    "api_version": null,
    "attachments": [
      {
        "arguments": [
          "--property"
        ],
        "command": "gcloud completers-attached"
      }
    ],
    "collection": null,
    "module_path": "googlecloudsdk.command_lib.config.completers:PropertiesCompleter",
    "type": "function"
  },
  {
    "api_version": null,
    "attachments": [
      {
        "arguments": [
          "--bogus"
        ],
        "command": "gcloud completers-attached"
      }
    ],
    "collection": "ERROR: API named [bogus] does not exist in the APIs map",
    "module_path": "googlecloudsdk.completers_attached:BogusCollectionCompleter",
    "type": "ListCommandCompleter"
  },
  {
    "api_version": null,
    "attachments": [
      {
        "arguments": [
          "instance"
        ],
        "command": "gcloud completers-attached"
      }
    ],
    "collection": "compute.instances",
    "module_path": "googlecloudsdk.completers_attached:InstancesCompleter",
    "type": "ListCommandCompleter"
  },
  {
    "api_version": "v1",
    "attachments": [
      {
        "arguments": [
          "--clone"
        ],
        "command": "gcloud completers-attached"
      }
    ],
    "collection": "compute.instances",
    "module_path": "googlecloudsdk.completers_attached:InstancesCompleterV1",
    "type": "ListCommandCompleter"
  }
]
""")