Skip to content

Commit 819af81

Browse files
committed
feat(crg): add crg-grade and crg-badge justfile recipes
1 parent 45eaa7f commit 819af81

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
@@ -114,3 +114,21 @@ help-me:
114114
@echo " https://github.com/hyperpolymath/im-docs/issues/new"
115115
@echo ""
116116
@echo "Include the output of 'just doctor' in your report."
117+
118+
119+
# Print the current CRG grade (reads from READINESS.md '**Current Grade:** X' line)
120+
crg-grade:
121+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
122+
[ -z "$$grade" ] && grade="X"; \
123+
echo "$$grade"
124+
125+
# Generate a shields.io badge markdown for the current CRG grade
126+
# Looks for '**Current Grade:** X' in READINESS.md; falls back to X
127+
crg-badge:
128+
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
129+
[ -z "$$grade" ] && grade="X"; \
130+
case "$$grade" in \
131+
A) color="brightgreen" ;; B) color="green" ;; C) color="yellow" ;; \
132+
D) color="orange" ;; E) color="red" ;; F) color="critical" ;; \
133+
*) color="lightgrey" ;; esac; \
134+
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)