INNER CODE UNIT · Python

PrintsHelpOnErrorArgumentParser

Yelp/paasta · paasta_tools/cli/cli.py:57

class PrintsHelpOnErrorArgumentParser(argparse.ArgumentParser):
    """Overriding the error method allows us to print the whole help page,
    otherwise the python arg parser prints a not-so-useful usage message that
    is way too terse"""

    def error(self, message):
        print(f"Argument parse error: {message}\n")
        self.print_help()
        sys.exit(1)


def list_external_commands():
    p = subprocess.check_output(["/bin/bash", "-p", "-c", "compgen -A command paasta-"])
    lines = p.decode("utf-8").strip().split("\n")
    return {line.replace("paasta-", "", 1) for line in lines}


def calling_external_command():

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…