mirror of
https://github.com/NotXia/unibo-ai-notes.git
synced 2025-12-15 19:12:22 +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:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths: ["src/**", .github/workflows/**, ./compile.sh]
|
paths: ["src/**", .github/workflows/**, compile.sh]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
compile:
|
compile:
|
||||||
|
|||||||
31
compile.sh
31
compile.sh
@ -22,14 +22,14 @@ work_dir=`realpath src`
|
|||||||
mkdir -p $out_dir
|
mkdir -p $out_dir
|
||||||
touch $hash_file
|
touch $hash_file
|
||||||
|
|
||||||
# $1: path of the directory
|
|
||||||
getDirLastHash() {
|
getDirLastHash() {
|
||||||
|
# $1: path of the directory
|
||||||
path="$1"
|
path="$1"
|
||||||
echo `awk -F"," "\\$1 == \"$path\" { print \\$2 } " $hash_file`
|
echo `awk -F"," "\\$1 == \"$path\" { print \\$2 } " $hash_file`
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: path of the directory
|
|
||||||
getDirCurrHash() {
|
getDirCurrHash() {
|
||||||
|
# $1: path of the directory
|
||||||
path="$1"
|
path="$1"
|
||||||
echo `git log -n 1 --format='%h' $path/**/*.!(cls)`
|
echo `git log -n 1 --format='%h' $path/**/*.!(cls)`
|
||||||
}
|
}
|
||||||
@ -49,6 +49,19 @@ updateHashes() {
|
|||||||
done
|
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
|
cd $work_dir
|
||||||
|
|
||||||
@ -90,4 +103,16 @@ for f in **/[!_]*.tex; do
|
|||||||
cd $work_dir
|
cd $work_dir
|
||||||
done
|
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