Пример #1
0
 def Run(self, args):
     branch = args.branch.split('.') if args.branch else None
     if args.completions:
         generate.ListCompletionTree(cli=self._cli_power_users_only,
                                     branch=branch)
     else:
         cli_tree.Dump(cli=self._cli_power_users_only,
                       path='-',
                       branch=branch)
    def testFirstUpdate(self):
        # Ensure table file does not exist
        table_path = cli_tree.CliTreePath()
        self.assertEqual(self.table_file_path, table_path)

        # Update the table
        cli_tree.Dump(self.test_cli)

        # Ensure table exists
        self.assertTrue(os.path.isfile(self.table_file_path))
    def testTableContentsAndLoading(self):
        # Update the table
        cli_tree.Dump(self.test_cli)

        # Check contents
        self.AssertFileIsGolden(self.table_file_path, __file__, 'gcloud.json')

        # Load table
        table_contents = cli_tree.Load()

        # Basic check of table contents
        self.assertTrue('beta' in table_contents[lookup.COMMANDS])
        self.assertTrue('--help' in table_contents[lookup.FLAGS])
    def testOverridingUpdate(self):
        # Create table file
        with open(self.table_file_path, 'w') as table_file:
            table_contents = 'I am a help table.\n'
            table_file.write(table_contents)
        with open(self.table_file_path) as table_file:
            self.assertEqual(table_contents, table_file.readline())

        # Update the table
        cli_tree.Dump(self.test_cli)

        # Ensure table files exist
        self.assertTrue(os.path.isfile(self.table_file_path))

        # Ensure table files contents have been updated
        with open(self.table_file_path) as table_file:
            self.assertNotEquals(table_contents, table_file.readline())
Пример #5
0
    def Run(self, args):
        # Re-compile python files.
        state = local_state.InstallationState.ForCurrent()
        state.CompilePythonFiles()

        # Delete the deprecated completion cache.
        resource_cache.DeleteDeprecatedCache()

        # Delete the completion cache.
        try:
            resource_cache.ResourceCache(create=False).Delete()
        except cache_exceptions.CacheNotFound:
            pass
        except cache_exceptions.Error as e:
            log.info('Unexpected resource cache error ignored: [%s].', e)

        # Re-generate the static gcloud CLI tree.
        cli_tree.Dump(self._cli_power_users_only, path=cli_tree.CliTreePath())
Пример #6
0
 def Run(self, args):
     branch = args.branch.split('.') if args.branch else None
     cli_tree.Dump(cli=self._cli_power_users_only, path='-', branch=branch)
Пример #7
0
 def Run(self, args):
     cli_tree.Dump(cli=self._cli_power_users_only, path='-')