-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreateDocu.sh
56 lines (49 loc) · 1.46 KB
/
createDocu.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#latest md-click has a bug that crashes if there are no options for inital command. fixed by using fixed branch that has not been merged
# git clone https://github.com/kid-116/md-click.git
# cd md-click/
# git checkout support-arguments
# git pull
# pip install .
cd $(dirname $0)
#clean up to make sure there are no remnants
rm docs/raw/*md
mdclick dumps --baseModule=terrapi.cli.terrapi_cli --baseCommand=terrapi --docsPath=docs/raw
cd docs/raw
#patch documenation that make issues in docusaurus
sed -i 's#<click.types.File .*>#File#g' *md
sed -i 's#<ConsoleStream name.*stdout.*>#stdout#g' *md
copyAddingHeader (){
echo "---
id: $3
title: $3
description: terrapi command line library documentation - slurm subcommand
---">$2
cat $1>>$2
}
move2Subfolders () {
local start=$1
local folder=$2
local md
local sub
mkdir -p $folder/$start
for md in $(ls ${start}-*.md)
do
#echo doing $md
sub=${md/${start}-}
sub=${sub/.md/}
#echo "sub is: $sub"
ls ${sub}-*.md 2>/dev/null >/dev/null
if [ "$?" -eq "0" ]
then
#echo calling move2Subfolders $sub ${folder}/${start}
move2Subfolders $sub ${folder}/${start}
copyAddingHeader $md ${folder}/${start}/${sub}/${sub}.md ${sub}
else
#final command
copyAddingHeader $md $folder/$start/${sub}.md $sub
fi
done
}
move2Subfolders terrapi ../docusaurus
cp terrapi.md ../docusaurus/terrapi