Commit 374cce0a authored by Moul's avatar Moul Committed by Mael
Browse files

[enh] #130: prevent erasing authfile:

- ask for confirmation if file exists in order to erase.
parent 897dbdd0
......@@ -16,7 +16,7 @@ along with Silkaj. If not, see <>.
from import message_exit
from click import command, option, pass_context
from click import command, option, pass_context, confirm
from getpass import getpass
from pathlib import Path
from re import compile, search
......@@ -40,6 +40,16 @@ def auth_method(ctx):
@option("--file", default="authfile", show_default=True, help="Path file")
def generate_auth_file(file):
key = auth_method()
authfile = Path(file)
if authfile.is_file():
"Would you like to erase "
+ file
+ " by an authfile corresponding to following pubkey `"
+ key.pubkey
+ "`?",
"Authentication file 'authfile' generated and stored in current\
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment