forked from claranet/terraform-datadog-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path20_update_global_readme.sh
More file actions
executable file
·28 lines (26 loc) · 1.01 KB
/
20_update_global_readme.sh
File metadata and controls
executable file
·28 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
source "$(dirname $0)/utils.sh"
init
echo "Update global README.md"
# only keep current README from begining to "[Monitors/Integrations] summary" section (delete list)
sed -i "/### ${REPO^} summary ###/q" README.md
# add a newline after listing section
echo >> README.md
# loop over path of modules tree
for path in $(find -mindepth 1 -type d ! -path '*/.*' ! -path './scripts*' -print | sort -fdbi); do
# split path in directories
directories=($(list_dirs $path))
# loop over directories in path
for i in $(seq 1 $((${#directories[@]}-1))); do
## add tabulation for every subdirectory
echo -en "\t" >> README.md
done
# add link to list of modules
echo -en "- [$(basename ${path})](https://git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/${REPO}/tree/master/" >> README.md
# add path to link
for directory in "${directories[@]}"; do
echo -en "${directory}/" >> README.md
done
# end of markdown link
echo ")" >> README.md
done