feat: Add new gcloud commands, API clients, and third-party libraries across various services.

This commit is contained in:
2026-01-01 20:26:35 +01:00
parent 5e23cbece0
commit a19e592eb7
25221 changed files with 8324611 additions and 0 deletions

View File

@@ -0,0 +1 @@
set enable-bracketed-paste off

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Test script used by test.TestBash."""
import argparse
import os
import sys
import argcomplete
def complete_cont(*args, **kwargs):
return ["foo=", "bar/", "baz:"]
def check_environ(*args, **kwargs):
assert "COMP_TYPE" in os.environ, "wrapper should have set COMP_TYPE"
assert len(sys.argv) == 1, "should never be completed with arguments"
return ["ok"]
def print_output(*args, **kwargs):
print("PYTHON_ARGCOMPLETE_STDOUT")
print("PYTHON_ARGCOMPLETE_STDERR", file=sys.stderr)
return ["foo"]
def get_comp_point(*args, **kwargs):
return [os.environ["COMP_POINT"]]
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
subparsers.add_parser("basic", help="basic help\nnext line of help").add_argument("arg", choices=["foo", "bar", "baz"])
subparsers.add_parser("space").add_argument("arg", choices=["foo bar", "baz"])
subparsers.add_parser("cont").add_argument("arg").completer = complete_cont
subparsers.add_parser("spec").add_argument("arg", choices=["d$e$f", "d$e$g", "x!x", r"y\y"])
subparsers.add_parser("quote").add_argument("arg", choices=["1'1", '2"2'])
subparsers.add_parser("break", help="break help").add_argument("arg", choices=["a:b:c", "a:b:d"])
subparsers.add_parser("env").add_argument("arg").completer = check_environ
subparsers.add_parser("debug").add_argument("arg").completer = print_output
subparsers.add_parser("point", add_help=False).add_argument("arg", nargs="*").completer = get_comp_point
if "POINT" in os.environ:
argcomplete.autocomplete(parser, validator=lambda x, y: True)
else:
argcomplete.autocomplete(parser)
args = parser.parse_args()
if "POINT" in os.environ:
print(args.arg[-1])
else:
print(args.arg)

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
from sys import argv
if argv[1:] != ["no-input"]:
input()

View File

@@ -0,0 +1,80 @@
#!/usr/bin/env python
import os
import os.path
import unittest
import pexpect
import pexpect.replwrap
from .test import BASE_DIR, TEST_DIR, Shell, TestShellBase
@unittest.skip("tcsh is not supported. Enable this test manually if needed.")
class TestTcsh(TestShellBase, unittest.TestCase):
expected_failures = [
"test_unquoted_space",
"test_quoted_space",
"test_continuation",
"test_parse_special_characters",
"test_parse_special_characters_dollar",
# Test case doesn't work under tcsh, could be fixed.
"test_comp_point",
]
def setUp(self):
sh = Shell("tcsh")
path = " ".join([os.path.join(BASE_DIR, "scripts"), TEST_DIR, "$path"])
sh.run_command("set path = ({0})".format(path))
sh.run_command("setenv PYTHONPATH {0}".format(BASE_DIR))
# 'dummy' argument unused; checks multi-command registration works
# by passing 'prog' as the second argument.
output = sh.run_command("eval `register-python-argcomplete --shell tcsh dummy prog`")
self.assertEqual(output, "")
# Register a dummy completion with an external argcomplete script
# to ensure this doesn't overwrite our previous registration.
output = sh.run_command(
"eval `register-python-argcomplete --shell tcsh dummy --external-argcomplete-script dummy`"
)
self.assertEqual(output, "")
self.sh = sh
def tearDown(self):
# The shell wrapper is fragile; exactly which exception is raised
# differs depending on environment.
with self.assertRaises((pexpect.EOF, OSError)):
self.sh.run_command("exit")
self.sh.run_command("")
@unittest.skip("fish is not supported. Enable this test manually if needed.")
class TestFish(TestShellBase, unittest.TestCase):
expected_failures = [
"test_parse_special_characters",
"test_comp_point",
]
skipped = ["test_single_quotes_in_single_quotes", "test_parse_special_characters_dollar"]
def setUp(self):
sh = Shell("fish")
path = " ".join([os.path.join(BASE_DIR, "scripts"), TEST_DIR, "$PATH"])
sh.run_command("set -x PATH {0}".format(path))
sh.run_command("set -x PYTHONPATH {0}".format(BASE_DIR))
# 'dummy' argument unused; checks multi-command registration works
# by passing 'prog' as the second argument.
output = sh.run_command("register-python-argcomplete --shell fish dummy prog | source")
self.assertEqual(output, "")
# Register a dummy completion with an external argcomplete script
# to ensure this doesn't overwrite our previous registration.
output = sh.run_command(
"register-python-argcomplete --shell fish dummy --external-argcomplete-script dummy | source"
)
self.assertEqual(output, "")
self.sh = sh
def tearDown(self):
# The shell wrapper is fragile; exactly which exception is raised
# differs depending on environment.
with self.assertRaises((pexpect.EOF, OSError)):
self.sh.run_command("exit")
self.sh.run_command("")

View File

@@ -0,0 +1,14 @@
from setuptools import setup
setup(
name="test-package",
version="0",
py_modules=["test_module"],
packages=["test_package"],
entry_points={
"console_scripts": [
"test-module=test_module:main",
"test-package=test_package:main",
]
},
)

View File

@@ -0,0 +1,6 @@
# PYTHON_ARGCOMPLETE_OK
from test_package import main
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,16 @@
# PYTHON_ARGCOMPLETE_OK
import argparse
import argcomplete
def main():
parser = argparse.ArgumentParser()
parser.add_argument("arg", choices=["arg"])
argcomplete.autocomplete(parser)
args = parser.parse_args()
print(args.arg)
if __name__ == "__main__":
main()