Browse Source

Bug fixes for tags

- Prevent generation_date tag format from being modified when SAVE_DATE_FORMAT is
  specified
- Prevent NoneType from ending up in the tags (previous fix did not work)
pull/400/head
Pierce Cohen 6 months ago
parent
commit
a4065c51b4
No known key found for this signature in database
GPG Key ID: 2549E06ECBFDEDE0
  1. 4
      installer/client/cli/save.py

4
installer/client/cli/save.py

@ -54,12 +54,12 @@ def main(tag, tags, silent, fabric):
# Prevent a NoneType ending up in the tags # Prevent a NoneType ending up in the tags
frontmatter_tags = "" frontmatter_tags = ""
if fabric: if fabric:
frontmatter_tags = os.getenv(FM_KEY) frontmatter_tags = os.getenv(FM_KEY) or ""
with open(target, "w") as fp: with open(target, "w") as fp:
if frontmatter_tags or len(tags) != 0: if frontmatter_tags or len(tags) != 0:
fp.write("---\n") fp.write("---\n")
now = datetime.now().strftime(f"{DATE_FORMAT} %H:%M") now = datetime.now().strftime(f"%Y-%m-%d %H:%M")
fp.write(f"generation_date: {now}\n") fp.write(f"generation_date: {now}\n")
fp.write(f"tags: {frontmatter_tags} {tag} {' '.join(tags)}\n") fp.write(f"tags: {frontmatter_tags} {tag} {' '.join(tags)}\n")
fp.write("---\n") fp.write("---\n")

Loading…
Cancel
Save