fix: add stdout as fallback if no out file is defined

This commit is contained in:
Robert Kaussow 2023-05-30 14:00:07 +02:00
parent 9cc91ca493
commit 0017111207
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
2 changed files with 9 additions and 5 deletions

View File

@ -3,6 +3,7 @@
import argparse
import copy
import os
import sys
from collections import defaultdict
import semantic_version
@ -118,12 +119,15 @@ class Autotag:
v = self._tag_suffix(v, config["suffix"], config["suffix_strict"])
v = self._tag_extra(v, config["extra"])
if config["file"]:
try:
try:
if config["file"]:
with open(config["file"], "w") as f:
f.write(",".join(v))
except OSError as e:
self.logger.error(f"Unable to write file: {e!s}")
else:
sys.stdout.write(",".join(v))
sys.stdout.write("\n")
except OSError as e:
self.logger.error(f"Unable to write file: {e!s}")
def main():

View File

@ -22,7 +22,7 @@ def trim_prefix(text, prefix):
def to_prerelease(tup):
return "".join(tup)
return ".".join(tup)
class Singleton(type):