43 lines
678 B
Bash
Executable File
43 lines
678 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# shellcheck source=./bin/_commands/_extract.sh
|
|
. ./_commands/_extract.sh
|
|
|
|
dir=$1 file=$2
|
|
|
|
echo "Default actions for ${dir##*/content/}/$file"
|
|
|
|
create() {
|
|
values=$(extract "$dir" "$file" ac_create)
|
|
|
|
for value in $values
|
|
do
|
|
target=${dir%/users/*}/users/$user/${value#/pages/}
|
|
target=$(dirname "$target")
|
|
|
|
mkdir -p "$target"
|
|
cp "../content$value.md" "$target"
|
|
|
|
./ac_route.sh "$target" "${value##*/}.md"
|
|
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
|
|
user=${dir#*/users/}
|
|
user=${user%%/*}
|
|
|
|
create
|
|
delete
|
|
fi
|