Skip to content

Commit 59687df

Browse files
committed
✨ Add list command.
1 parent 13813dd commit 59687df

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

Makefile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,42 @@
11
GITMOJI_VERSION=v3.0.0
22
BASE_FILE=https://raw.githubusercontent.com/carloscuesta/gitmoji/$(GITMOJI_VERSION)/src/data/gitmojis.json
33

4+
# See: https://gist.github.com/rsperl/d2dfe88a520968fbc1f49db0a29345b9
5+
COLOR := $(shell tput -Txterm setaf 5)
6+
RESET := $(shell tput -Txterm sgr0)
7+
48
gen:
5-
@echo ""
6-
@echo "---- Fetch gitmojis.json ($(GITMOJI_VERSION))----"
9+
@echo
10+
@echo "$(COLOR)# Fetch gitmojis.json ($(GITMOJI_VERSION))$(RESET)"
711
mkdir -p build build/src build/dist
812
curl -so build/src/gitmojis.json $(BASE_FILE)
913

10-
@echo ""
11-
@echo ""
12-
@echo "---- Add semver field to gitmojis.json from semver.yml ----"
14+
@echo
15+
@echo
16+
@echo "$(COLOR)# Add semver field$(RESET)"
1317
yq '.' semver.yml > build/src/semver.json
1418
node script.js
1519
cat build/dist/tmp.json | jq > build/dist/gitmojis.json
1620
yq -y '.' build/dist/gitmojis.json > build/dist/gitmojis.yml
1721
rm build/dist/tmp.json
1822

19-
@echo ""
20-
@echo ""
21-
@echo "---- Successfully ----"
22-
@echo "Semver field added to gitmojis.json and gitmojis.yml created"
23+
@echo
24+
@echo
25+
@echo "$(COLOR)# Generated!$(RESET)"
26+
@echo "Generated gitmojis.json and gitmojis.yml whith semver field"
2327
@echo "See ./build/dist"
28+
29+
@echo
30+
@make list
31+
32+
FORMAT={emoji:.emoji, code:.code, desc: .description}
33+
GITMOJI_FILE=build/dist/gitmojis.json
34+
list:
35+
@echo "\n# Major (Breaking)"
36+
@cat $(GITMOJI_FILE) | jq -c '.gitmojis[] | select(.semver=="major") | $(FORMAT)'
37+
@echo "\n# Minor (Feature)"
38+
@cat $(GITMOJI_FILE) | jq -c '.gitmojis[] | select(.semver=="minor") | $(FORMAT)'
39+
@echo "\n# Patch (Fix)"
40+
@cat $(GITMOJI_FILE) | jq -c '.gitmojis[] | select(.semver=="patch") | $(FORMAT)'
41+
@echo "\n# None"
42+
@cat $(GITMOJI_FILE) | jq -c '.gitmojis[] | select(.semver=="none") | $(FORMAT)'

0 commit comments

Comments
 (0)