diff --git a/maubot/cli/cliq/validators.py b/maubot/cli/cliq/validators.py index 99618b9..2a98252 100644 --- a/maubot/cli/cliq/validators.py +++ b/maubot/cli/cliq/validators.py @@ -76,7 +76,7 @@ class VersionValidator(ClickValidator): def spdx(val: str) -> str: - if spdxlib.valid(val): + if not spdxlib.valid(val): raise click.BadParameter(f"{val} is not a valid SPDX license identifier") return val diff --git a/maubot/cli/commands/init.py b/maubot/cli/commands/init.py index 63bf3c2..cc6b55e 100644 --- a/maubot/cli/commands/init.py +++ b/maubot/cli/commands/init.py @@ -57,8 +57,9 @@ def init(name: str, id: str, version: Version, license: str, config: bool) -> No main_class=main_class) with open("maubot.yaml", "w") as file: file.write(meta) - with open("LICENSE", "w") as file: - file.write(spdx.get(license)["text"]) + if license: + with open("LICENSE", "w") as file: + file.write(spdx.get(license)["text"]) if not os.path.isdir(name): os.mkdir(name) mod = mod_template.render(config=config, name=main_class)