def install_hook(ctx):
    """ Install gitlint as a git commit-msg hook. """
    try:
        lint_config = ctx.obj[0]
        hooks.GitHookInstaller.install_commit_msg_hook(lint_config)
        # declare victory :-)
        hook_path = hooks.GitHookInstaller.commit_msg_hook_path(lint_config)
        click.echo(u"Successfully installed gitlint commit-msg hook in {0}".format(hook_path))
        ctx.exit(0)
    except hooks.GitHookInstallerError as e:
        click.echo(ustr(e), err=True)
        ctx.exit(GIT_CONTEXT_ERROR_CODE)
def install_hook ( ctx ) : try : lint_config = ctx . obj [ 0 ] hooks . GitHookInstaller . install_commit_msg_hook ( lint_config ) hook_path = hooks . GitHookInstaller . commit_msg_hook_path ( lint_config ) click . echo ( u"Successfully installed gitlint commit-msg hook in {0}" . format ( hook_path ) ) ctx . exit ( 0 ) except hooks . GitHookInstallerError as e : click . echo ( ustr ( e ) , err = True ) ctx . exit ( GIT_CONTEXT_ERROR_CODE )
Install gitlint as a git commit-msg hook.