Protect config login against empty config file

This commit is contained in:
Gabriel Augendre 2019-12-28 10:44:30 +01:00
parent 4d254fc72e
commit 64068989a1
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4

View file

@ -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(