forked from kubescape/regolibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00e7d24
commit c011ff1
Showing
3 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
|
||
# Generates new ID for controls. Run it when adding a new control and set the ouput as the 'id' field | ||
|
||
|
||
# Get current highest id from all controls | ||
HIGHEST_ID=$(grep \"id\": ../controls/*.json -h | cut -d "-" -f 2 | sort | tail -n1 | sed 's/"//g;s/0//g') | ||
|
||
NEW_ID=$(echo $(($HIGHEST_ID + 1))) | ||
|
||
|
||
[ $NEW_ID -lt 10 ] && NEW_ID="0$NEW_ID" | ||
|
||
[ $NEW_ID -lt 100 ] && NEW_ID="0$NEW_ID" | ||
|
||
[ $NEW_ID -lt 1000 ] && NEW_ID="0$NEW_ID" | ||
|
||
echo "C-$NEW_ID" |