From 4daefabaf76cef43f7e461527697484c1adb6e66 Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Fri, 16 Jun 2023 12:08:41 +0200 Subject: [PATCH] v1 authentication: stop reading default './authfile' (#420) It has to be specified as an argument and no longer as an option Pass Path directly (#469) Rename variable --- silkaj/auth.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/silkaj/auth.py b/silkaj/auth.py index dd854f4d..b06c5542 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}", ) -- GitLab