mirror of
https://github.com/NotXia/unibo-ai-notes.git
synced 2025-12-14 18:51:52 +01:00
Update output directory hierarchy
This commit is contained in:
2
.github/workflows/compile.yml
vendored
2
.github/workflows/compile.yml
vendored
@ -4,7 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths: ["src/**", .github/workflows/**, ./compile.sh]
|
||||
paths: ["src/**", .github/workflows/**, compile.sh]
|
||||
|
||||
jobs:
|
||||
compile:
|
||||
|
||||
31
compile.sh
31
compile.sh
@ -22,14 +22,14 @@ work_dir=`realpath src`
|
||||
mkdir -p $out_dir
|
||||
touch $hash_file
|
||||
|
||||
# $1: path of the directory
|
||||
getDirLastHash() {
|
||||
# $1: path of the directory
|
||||
path="$1"
|
||||
echo `awk -F"," "\\$1 == \"$path\" { print \\$2 } " $hash_file`
|
||||
}
|
||||
|
||||
# $1: path of the directory
|
||||
getDirCurrHash() {
|
||||
# $1: path of the directory
|
||||
path="$1"
|
||||
echo `git log -n 1 --format='%h' $path/**/*.!(cls)`
|
||||
}
|
||||
@ -49,6 +49,19 @@ updateHashes() {
|
||||
done
|
||||
}
|
||||
|
||||
moveHierarchyUp() {
|
||||
# Recursively moves the content of a directory up of a level.
|
||||
# $1: starting directory
|
||||
cd $1
|
||||
mv ./*.* ../
|
||||
for dir in */; do
|
||||
[ "$dir" == "*/" ] && continue
|
||||
moveHierarchyUp $dir
|
||||
done
|
||||
cd ..
|
||||
rmdir $1 2> /dev/null
|
||||
}
|
||||
|
||||
|
||||
cd $work_dir
|
||||
|
||||
@ -90,4 +103,16 @@ for f in **/[!_]*.tex; do
|
||||
cd $work_dir
|
||||
done
|
||||
|
||||
updateHashes
|
||||
updateHashes
|
||||
|
||||
# Moves the content of each output directory up of a level
|
||||
cd $out_dir
|
||||
for course_dir in */; do
|
||||
[ "$course_dir" == "*/" ] && continue
|
||||
cd $course_dir
|
||||
for dir in */; do
|
||||
[ "$dir" == "*/" ] && continue
|
||||
moveHierarchyUp $dir
|
||||
done
|
||||
cd ..
|
||||
done
|
||||
Reference in New Issue
Block a user