Does click lib provide a way to print the builtin help message?

You can use Command's get_help method

import click

@click.command()
@click.option('--name', help='The person to greet.')
def hello(name):
    """Simple program that greets NAME."""
    click.echo('Hello %s!' % name)

def print_help_msg(command):
    with click.Context(command) as ctx:
        click.echo(command.get_help(ctx))

>> print_help_msg(hello)

In click 5.x you can now use the get_current_context() method:

def print_help():
    ctx = click.get_current_context()
    click.echo(ctx.get_help())
    ctx.exit()

And if you're interested in just printing an error message and exiting, try:

def exit_with_msg():
    ctx = click.get_current_context()
    ctx.fail("Something unexpected happened")