1

Publish ootQMK

This commit is contained in:
Evan Pratten 2024-01-07 13:24:34 -05:00
parent 361a88454c
commit 6b4dea18b9
2 changed files with 49 additions and 2 deletions

View File

@ -1,10 +1,10 @@
---
title: Building QMK Keyboard Firmware Out of Tree
description: Side-stepping the QMK monorepo for my own sanity
date: 2024-01-06
date: 2024-01-07
tags:
- keyboards
draft: true
draft: false
extra:
auto_center_images: true
aliases:

47
content/blog/dump_tags.py Normal file
View File

@ -0,0 +1,47 @@
import argparse
import sys
import logging
import frontmatter
from pathlib import Path
SCRIPT_DIR = Path(__file__).parent.resolve()
logger = logging.getLogger(__name__)
def main() -> int:
# Handle program arguments
ap = argparse.ArgumentParser()
ap.add_argument('-v', '--verbose', help='Enable verbose logging', action='store_true')
args = ap.parse_args()
# Configure logging
logging.basicConfig(
level=logging.DEBUG if args.verbose else logging.INFO,
format='%(levelname)s: %(message)s',
)
# Loop through each md file in the directory
md_files = SCRIPT_DIR.glob('*.md')
all_tags = []
for file in md_files:
with open(file, 'r') as f:
front = frontmatter.load(f)
if "tags" in front.keys():
if isinstance(front["tags"], list):
all_tags.extend(front["tags"])
else:
all_tags.append(front["tags"])
# Remove duplicates
all_tags = [tag.split(" ") for tag in all_tags]
all_tags = [item for sublist in all_tags for item in sublist]
all_tags = list(dict.fromkeys(all_tags))
# Print all tags
for tag in all_tags:
print(tag)
return 0
if __name__ == "__main__":
sys.exit(main())