Initialize config when adding auth if non-existant

This commit is contained in:
rlaphoenix 2023-02-23 09:09:09 +00:00
parent 9932fa3f7a
commit 739c17bf4c
1 changed files with 2 additions and 0 deletions

View File

@ -255,6 +255,8 @@ def add(ctx: click.Context, profile: str, service: str, cookie: Optional[str] =
yaml, data = YAML(), None
yaml.default_flow_style = False
data = yaml.load(config_path)
if not data:
data = {}
if "credentials" not in data:
data["credentials"] = {}
if service not in data["credentials"]: