-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtfplugindocs.sh
executable file
·37 lines (32 loc) · 1.16 KB
/
tfplugindocs.sh
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
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
#set -x # uncomment for debug
set -e
if [ ! -d "docs" ] || [ ! -d "templates" ] || [ ! -d "examples" ]; then
echo "One or more required directories ('docs', 'templates', 'examples') do not exist. Exiting."
exit 1
fi
os_name=$(uname)
echo -e "\nFormat examples..."
terraform fmt -recursive examples
echo -e "\nGenerating docs..."
if [ "$os_name" == "Linux" ]; then
tfplugindocs generate --provider-name packetfabric
cd docs/resources
for file in *; do mv $file packetfabric_${file%%}; done
cd ../data-sources
for file in *; do mv $file packetfabric_${file%%}; done
cd ../..
find docs/* -name "*.md" -type f -exec sed -i 's/ Defaults: 0//g' {} \;
echo -e "\nDocs Updated"
elif [ "$os_name" == "Darwin" ]; then
tfplugindocs generate --provider-name packetfabric
cd docs/resources
for file in *; do mv $file packetfabric_${file%%}; done
cd ../data-sources
for file in *; do mv $file packetfabric_${file%%}; done
cd ../..
find docs/* -name "*.md" -type f -exec sed -i '' 's/ Defaults: 0//g' {} \;
echo -e "\nDocs Updated"
else
echo "This script is only compatible with Linux and macOS."
fi