2022-10-26 23:12:29 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# shellcheck source=./bin/_commands/_extract.sh
|
|
|
|
. ./_commands/_extract.sh
|
|
|
|
|
|
|
|
dir=$1 file=$2
|
|
|
|
|
2022-12-12 21:05:06 +01:00
|
|
|
echo "Default actions for ${dir##*/content/}/$file"
|
2022-10-26 23:12:29 +02:00
|
|
|
|
|
|
|
create() {
|
|
|
|
values=$(extract "$dir" "$file" ac_create)
|
|
|
|
|
|
|
|
for value in $values
|
|
|
|
do
|
2022-11-05 22:23:24 +01:00
|
|
|
target=${dir%/users/*}/users/$user/${value#/pages/}
|
|
|
|
target=$(dirname "$target")
|
|
|
|
|
|
|
|
mkdir -p "$target"
|
|
|
|
cp "../content$value.md" "$target"
|
|
|
|
|
|
|
|
./ac_route.sh "$target" "${value##*/}.md"
|
2022-10-26 23:12:29 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
delete() {
|
|
|
|
values=$(extract "$dir" "$file" ac_delete)
|
|
|
|
|
|
|
|
for value in $values
|
|
|
|
do
|
|
|
|
echo "Deleting $value"
|
|
|
|
rm -f "$dir/$value.md"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "${dir##*/content/users/*}" ]
|
|
|
|
then
|
2022-11-05 22:23:24 +01:00
|
|
|
user=${dir#*/users/}
|
|
|
|
user=${user%%/*}
|
|
|
|
|
2022-10-26 23:12:29 +02:00
|
|
|
create
|
|
|
|
delete
|
|
|
|
fi
|