Skip to content

Commit 591a12f

Browse files
authored
Merge branch 'main' into protocol-squad
2 parents 27241f4 + f6f0d41 commit 591a12f

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@ all: buf-lint buf-build test
2424
install:
2525
npm i
2626
rm -rf proto/google || true
27-
cp -r node_modules/protobufjs/google proto/google
27+
cp -r node_modules/protobufjs/google proto/google
28+
29+
list-components-ids:
30+
@bash scripts/list-components-ids.sh
31+
32+
check-component-id:
33+
@bash scripts/check-component-id.sh $(ID)

scripts/check-component-id.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
echo "Usage: make check-component-id ID=<id>"
5+
exit 1
6+
fi
7+
8+
id=$1
9+
10+
matches=$(find . -name "*.proto" -exec grep -l "option (common\.ecs_component_id) = $id;" {} +)
11+
12+
if [ -z "$matches" ]; then
13+
echo "id $id is free"
14+
else
15+
echo "id $id is taken"
16+
fi

scripts/list-components-ids.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
ids=$(find . -name "*.proto" -exec grep -ho 'option (common\.ecs_component_id) = [0-9]\+;' {} + | sed -E 's/.*= ([0-9]+);/\1/' | sort -n)
4+
5+
count=$(echo "$ids" | wc -l | xargs)
6+
7+
echo "List of ids ($count total):"
8+
9+
i=1
10+
echo "$ids" | while read id; do
11+
echo "$i. $id"
12+
((i++))
13+
done
14+

0 commit comments

Comments
 (0)