import click


def user_sub_command(subcommand):
    """common options for user subcommands"""
    for decorator in reversed(
        (
            click.option("--name", "-n", help="User's name"),
            click.option("--username", "-u", help="login username", required=True),
            click.option("--password", "-p", help="login password"),
            click.option(
                "--expiration",
                "-e",
                help="expiration date for accout (UNIX timestamp). -1 means never expire. default is -1.",
                default=-1,
            ),
            click.option("--role", "-r", help="user role", default="user"),
            click.option("--email", help="user email"),
        )
    ):
        subcommand = decorator(subcommand)
    return subcommand