def run(self, options, args):
        """Prints the completion code of the given shell"""
        shells = COMPLETION_SCRIPTS.keys()
        shell_options = ['--' + shell for shell in sorted(shells)]
        if options.shell in shells:
            script = textwrap.dedent(
                COMPLETION_SCRIPTS.get(options.shell, '').format(
                    prog=get_prog())
            )
            print(BASE_COMPLETION.format(script=script, shell=options.shell))
        else:
            sys.stderr.write(
                'ERROR: You must pass {}\n' .format(' or '.join(shell_options))
            )
Prints the completion code of the given shell
product/gradle-plugin/src/main/python/pip/_internal/commands/completion.py