Skip to content

Commit 8ac67ac

Browse files
committed
feat(crg): add crg-grade and crg-badge justfile recipes
1 parent fb4cf0c commit 8ac67ac

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Justfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,21 @@ help-me:
8181
assail:
8282
panic-attack assail .
8383

84+
85+
86+
# Print the current CRG grade (reads from READINESS.md '**Current Grade:** X' line)
87+
crg-grade:
88+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
89+
[ -z "$$grade" ] && grade="X"; \
90+
echo "$$grade"
91+
92+
# Generate a shields.io badge markdown for the current CRG grade
93+
# Looks for '**Current Grade:** X' in READINESS.md; falls back to X
94+
crg-badge:
95+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
96+
[ -z "$$grade" ] && grade="X"; \
97+
case "$$grade" in \
98+
A) color="brightgreen" ;; B) color="green" ;; C) color="yellow" ;; \
99+
D) color="orange" ;; E) color="red" ;; F) color="critical" ;; \
100+
*) color="lightgrey" ;; esac; \
101+
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)