forked from cloudlinux/tuxcare-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.sh
29 lines (22 loc) · 822 Bytes
/
sidebar.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
#!/bin/bash
output_file="output.json"
echo "export default {" > "${output_file}"
for dir in docs/*/; do
dir_name=$(basename "$dir")
echo " '/${dir_name}/': [" >> "${output_file}"
echo " {" >> "${output_file}"
echo " collapsable: false," >> "${output_file}"
echo " children: [" >> "${output_file}"
echo " \"/${dir_name}/\"," >> "${output_file}"
for subdir in "${dir}"*/; do
if [ -d "${subdir}" ]; then
subdir_name=$(basename "${subdir}")
echo " \"/${dir_name}/${subdir_name}\"," >> "${output_file}"
fi
done
echo " ]" >> "${output_file}"
echo " }," >> "${output_file}"
echo " ]," >> "${output_file}"
done
echo "}" >> "${output_file}"
cat output.json