From 64068989a1f47142aa7cf06e542ddc62acb408d4 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 28 Dec 2019 10:44:30 +0100 Subject: [PATCH] Protect `config login` against empty config file --- cleantoots/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cleantoots/config.py b/cleantoots/config.py index 86fac12..245259d 100644 --- a/cleantoots/config.py +++ b/cleantoots/config.py @@ -92,6 +92,11 @@ def edit(config): @click.pass_obj def login(config): """Fetch credentials for each app described in config file.""" + if not config.sections(): + click.secho("The config file doesn't seem to have any section.", fg="yellow") + command = click.style("cleantoots config setup", bold=True) + click.secho("You should set it up first. Use: {}".format(command)) + return for section in config.sections(): section = config[section] Mastodon.create_app(