From 8ca878e7608a63ebe541f717a5dd751be7a3337e Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 31 Oct 2017 12:15:13 +0100 Subject: [PATCH] Add ability for XKCD style passwords to workflow Signed-off-by: Knut Ahlers --- alfred-workflow/exec.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/alfred-workflow/exec.py b/alfred-workflow/exec.py index 0bb44a3..0c286e0 100644 --- a/alfred-workflow/exec.py +++ b/alfred-workflow/exec.py @@ -20,6 +20,7 @@ descriptions = { def main(wf): password_length = 20 use_special = False + use_xkcd = False if len(wf.args): for arg in wf.args[0].split(): @@ -27,10 +28,12 @@ def main(wf): password_length = int(arg) elif arg == 's': use_special = True + elif arg == 'x': + use_xkcd = True - if password_length < 5 or password_length > 256: + if password_length < 4 or password_length > 256: wf.add_item(title="Password length out of bounds", - subtitle="Please use a reasonable password length between 5 and 256") + subtitle="Please use a reasonable password length between 4 and 256") wf.send_feedback() return 1 @@ -39,6 +42,8 @@ def main(wf): str(password_length)] if use_special: command.append("-s") + if use_xkcd: + command.append("-x") result = json.loads(subprocess.check_output(command).strip()) hashed = []