-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.sh
55 lines (48 loc) · 1.27 KB
/
readme.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
#!/bin/bash
# CONTRIBUTION
## Author: Tom Sapletta
## Created Date: 2.05.2022
# EXAMPLE
# ./readme.sh
# TODO: github actions to merge the all files in the fly
# CONFIG
LOGS="readme.logs.txt"
PROJECTS=readme.txt
PROJECT_LIST=$(cat $PROJECTS)
LOCAL_PATH=$(pwd)
SUBFOLDER="DOCS"
MENU_URL="$SUBFOLDER/PROJECTS.md"
MENU_PATH="$SUBFOLDER/PROJECTS_LOCAL.md"
OUTPUT="README.md"
# START
echo "`date +"%T.%3N"` START" > $LOGS
echo "$(date +"%T.%3N") CREATE_MENU" >> $LOGS
#
DOMAIN=$(cat CNAME)
echo "+ [$DOMAIN](http://$DOMAIN)" > $MENU_URL
echo "+ [$LOCAL_PATH](file://$LOCAL_PATH/)" > $MENU_PATH
#
for FILE in */in.md; do
line=$(head -n 1 $FILE)
#echo "$FILE $line"
#echo PROTOCOL=${URL%%://*}
NAME=${FILE%%/*}
URL=$DOMAIN/$NAME
echo "+ [$NAME $line](http://$URL)" >> $MENU_URL
echo "+ [$NAME $line](file://$LOCAL_PATH/$NAME/index.html)" >> $MENU_PATH
done
## combine from another sites
echo "$(date +"%T.%3N") COMBINE_FILES" >> $LOGS
echo "" > $OUTPUT
for project in $PROJECT_LIST; do
echo "$(date +"%T.%3N") COMBINE_FILE $project" >> $LOGS
cat $project >> $OUTPUT
echo "" >> $OUTPUT
done
# Send to github
#git commit -m "Combine and update docs"
#git push
#firefox https://github.com/java-func/www
#open https://www.javafunc.com/
echo "`date +"%T.%3N"` STOP" >> $LOGS
cat $LOGS