Skip to content

Commit 4da3a37

Browse files
committed
feat(crg): add crg-grade and crg-badge justfile recipes
1 parent 2c0ac6a commit 4da3a37

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Justfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,21 @@ help-me:
481481
@echo " https://github.com/hyperpolymath/ipv6-tools/issues/new"
482482
@echo ""
483483
@echo "Include the output of 'just doctor' in your report."
484+
485+
486+
# Print the current CRG grade (reads from READINESS.md '**Current Grade:** X' line)
487+
crg-grade:
488+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
489+
[ -z "$$grade" ] && grade="X"; \
490+
echo "$$grade"
491+
492+
# Generate a shields.io badge markdown for the current CRG grade
493+
# Looks for '**Current Grade:** X' in READINESS.md; falls back to X
494+
crg-badge:
495+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
496+
[ -z "$$grade" ] && grade="X"; \
497+
case "$$grade" in \
498+
A) color="brightgreen" ;; B) color="green" ;; C) color="yellow" ;; \
499+
D) color="orange" ;; E) color="red" ;; F) color="critical" ;; \
500+
*) color="lightgrey" ;; esac; \
501+
echo "[![CRG $$grade](https://img.shields.io/badge/CRG-$$grade-$$color?style=flat-square)](https://github.com/hyperpolymath/standards/tree/main/component-readiness-grades)"

0 commit comments

Comments
 (0)