diff --git a/silkaj/auth.py b/silkaj/auth.py index dd854f4d460bf399bc0c15d9709cb78a88546dd2..b06c55420dcdeae90f904b53b5542bf01defd4f2 100644 --- a/silkaj/auth.py +++ b/silkaj/auth.py @@ -51,19 +51,20 @@ def has_auth_method(ctx: click.Context) -> bool: @click.command("authentication", help="Generate authentication file") -@click.option("--file", default="authfile", show_default=True, help="Path file") -def generate_auth_file(file: str) -> None: +@click.argument( + "auth_file", + type=click.Path(dir_okay=False, writable=True, path_type=Path), +) +def generate_auth_file(auth_file: Path) -> None: key = auth_method() - authfile = Path(file) pubkey_cksum = gen_pubkey_checksum(key.pubkey) - if authfile.is_file(): - message = f"Would you like to erase {file} by an authfile corresponding \n\ + if auth_file.is_file(): + message = f"Would you like to erase {auth_file} with an authentication file corresponding \n\ to following pubkey `{pubkey_cksum}`?" click.confirm(message, abort=True) - key.save_seedhex_file(file) + key.save_seedhex_file(auth_file) print( - f"Authentication file 'authfile' generated and stored in current\ - folder for following public key: {pubkey_cksum}", + f"Authentication file '{auth_file}' generated and stored for public key: {pubkey_cksum}", )