From b0ba30b5f375954a9ee457abdb321512a5674271 Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Tue, 16 Apr 2019 12:31:20 +0200 Subject: [PATCH] Minor code cleanup. Add and use helper function to ask a yes/no question. --- feediverse.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/feediverse.py b/feediverse.py index 446f439..3f0a409 100755 --- a/feediverse.py +++ b/feediverse.py @@ -169,9 +169,14 @@ def get_entry(entry, generator=None): } def setup(config_file): + + def yes_no(question): + res = input(question + ' [y/n] ') + return res.lower() in "y1" + url = input('What is your Mastodon Instance URL? ') - have_app = input('Do you have your app credentials already? [y/n] ') - if have_app.lower() == 'y': + have_app = yes_no('Do you have your app credentials already?') + if have_app: name = 'feediverse' client_id = input('What is your app\'s client id: ') client_secret = input('What is your client secret: ')