import click
import re


def validate_ticket_arg(ctx, param, name):
    """Verify issue id format and return issue slug"""
    if name is None:
        raise click.BadParameter('Ticket number is required')

    if re.match(r'^[a-zA-Z]+-\d+', name):
        return name

    raise click.BadParameter('Invalid ticket format {}'.format(name))