"""Rename a secret key."""

import typer

from mb_stash.cli.context import password_prompt, use_context


def rename(ctx: typer.Context, key: str, new_key: str) -> None:
    """Rename a secret key without changing its value."""
    app = use_context(ctx)
    app.core.service.rename(key, new_key, password_prompt=password_prompt)
    app.out.print_secret_renamed(key, new_key)
