Entry point for the tag CLI.

    Isolated as a method so that the CLI can be called by other Python code
    (e.g. for testing), in which case the arguments are passed to the function.
    If no arguments are passed to the function, parse them from the command
    line.

def main(args=None):
    """
    Entry point for the tag CLI.

    Isolated as a method so that the CLI can be called by other Python code
    (e.g. for testing), in which case the arguments are passed to the function.
    If no arguments are passed to the function, parse them from the command
    line.
    """
    if args is None:
        args = tag.cli.parser().parse_args()

    assert args.cmd in mains
    mainmethod = mains[args.cmd]
    mainmethod(args)