2024-06-26 14:33:34 +02:00
|
|
|
#! /usr/bin/env sh
|
|
|
|
|
|
|
|
# user-configured settings
|
|
|
|
TORI_ROOT="$HOME/.config/tori"
|
|
|
|
|
2024-06-26 15:47:20 +02:00
|
|
|
# global state
|
|
|
|
files=
|
|
|
|
|
2024-06-26 14:33:34 +02:00
|
|
|
# application logic
|
|
|
|
|
|
|
|
log() {
|
|
|
|
local level="$1" # unimplemented
|
|
|
|
local message="$2"
|
|
|
|
|
2024-06-26 15:47:20 +02:00
|
|
|
if [ -n "$DEBUG" ] && [ $level = debug ]; then
|
|
|
|
printf "$(date "+%H:%M:%N") $message\n"
|
|
|
|
fi
|
2024-06-26 14:33:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
traverse() {
|
|
|
|
local target="$1"
|
|
|
|
|
2024-06-26 15:47:20 +02:00
|
|
|
log debug "traversing $target"
|
|
|
|
if [ -d "$target" ]; then
|
|
|
|
log debug "found dir: $target"
|
|
|
|
files="$(find "$target" -type f)\n$files"
|
2024-06-26 14:33:34 +02:00
|
|
|
fi
|
2024-06-26 15:47:20 +02:00
|
|
|
|
|
|
|
log debug "collected files:\n$files"
|
2024-06-26 14:33:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cd "$TORI_ROOT"
|
|
|
|
for item in $TORI_ROOT/*; do
|
|
|
|
traverse "$item"
|
|
|
|
done
|