Skip to content
Snippets Groups Projects

Drop auth-file default path #420, Use click.prompt(), click_context testing

Merged Moul requested to merge 420_auth_file_click_prompt_click_context into main
1 file
+ 9
8
Compare changes
  • Side-by-side
  • Inline
+ 9
8
@@ -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}",
)
Loading