@@ -58,42 +58,34 @@ jobs:
5858 git config --global user.name "github-actions[bot]"
5959 git config --global user.email "github-actions[bot]@users.noreply.github.com"
6060
61- # Format and update README
6261 TOTAL_LINES=$(jq '.SUM.code // 0' output/cloc-output.json)
63- JS_LINES=$(jq '.JavaScript.code // 0' output/cloc-output.json)
64- TS_LINES=$(jq '.TypeScript.code // 0' output/cloc-output.json)
65- JSX_LINES=$(jq '.JSX.code // 0' output/cloc-output.json)
66- CSHARP_LINES=$(jq '."C#".code // 0' output/cloc-output.json)
67- VUE_LINES=$(jq '."Vuejs Component".code // 0' output/cloc-output.json)
68- PHP_LINES=$(jq '.PHP.code // 0' output/cloc-output.json)
69- OTHER_LINES=$((TOTAL_LINES - JS_LINES - TS_LINES - JSX_LINES - PHP_LINES - CSHARP_LINES - VUE_LINES))
7062
7163 # Function to format numbers with commas (ensuring proper locale settings)
7264 format_number() {
7365 export LC_ALL="en_US.UTF-8"
7466 printf "%'d\n" $1
7567 }
7668
69+ # Build sorted breakdown as CSV: lang,lines
70+ LANG_BREAKDOWN=$(jq -r 'to_entries
71+ | map(select(.key != "header" and .key != "SUM"))
72+ | map({lang: .key, lines: .value.code})
73+ | map(select(.lines > 1))
74+ | sort_by(-.lines)[]
75+ | "\(.lang),\(.lines)"' output/cloc-output.json)
76+
77+ FORMATTED_BREAKDOWN=""
78+ while IFS=, read -r LANG LINES; do
79+ FORMATTED=$(format_number $LINES)
80+ FORMATTED_BREAKDOWN+=$(printf "%-15s --> %10s lines\n" "$LANG" "$FORMATTED")$'\n'
81+ done <<< "$LANG_BREAKDOWN"
82+
7783 FORMATTED_TOTAL=$(format_number $TOTAL_LINES)
78- FORMATTED_JS=$(format_number $JS_LINES)
79- FORMATTED_TS=$(format_number $TS_LINES)
80- FORMATTED_JSX=$(format_number $JSX_LINES)
81- FORMATTED_CSHARP=$(format_number $CSHARP_LINES)
82- FORMATTED_VUE=$(format_number $VUE_LINES)
83- FORMATTED_PHP=$(format_number $PHP_LINES)
84- FORMATTED_OTHER=$(format_number $OTHER_LINES)
8584
8685 CODE_BLOCK="\`\`\`
8786 [ LANGUAGES BREAKDOWN ]
8887
89- JavaScript --> $FORMATTED_JS lines
90- TypeScript --> $FORMATTED_TS lines
91- JSX --> $FORMATTED_JSX lines
92- Vue.js --> $FORMATTED_VUE lines
93- PHP --> $FORMATTED_PHP lines
94- C# --> $FORMATTED_CSHARP lines
95- Other --> $FORMATTED_OTHER lines
96-
88+ $FORMATTED_BREAKDOWN
9789 [ TOTAL LINES OF CODE: $FORMATTED_TOTAL ]
9890 \`\`\`"
9991
0 commit comments