Skip to content

Commit 23a38ac

Browse files
committed
feat(crg): add crg-grade and crg-badge justfile recipes
1 parent 27cab88 commit 23a38ac

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
@@ -74,3 +74,21 @@ help-me:
7474
@echo " https://github.com/hyperpolymath/maa-framework/issues/new"
7575
@echo ""
7676
@echo "Include the output of 'just doctor' in your report."
77+
78+
79+
# Print the current CRG grade (reads from READINESS.md '**Current Grade:** X' line)
80+
crg-grade:
81+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
82+
[ -z "$$grade" ] && grade="X"; \
83+
echo "$$grade"
84+
85+
# Generate a shields.io badge markdown for the current CRG grade
86+
# Looks for '**Current Grade:** X' in READINESS.md; falls back to X
87+
crg-badge:
88+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
89+
[ -z "$$grade" ] && grade="X"; \
90+
case "$$grade" in \
91+
A) color="brightgreen" ;; B) color="green" ;; C) color="yellow" ;; \
92+
D) color="orange" ;; E) color="red" ;; F) color="critical" ;; \
93+
*) color="lightgrey" ;; esac; \
94+
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)