diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/categories | 20 | ||||
| -rwxr-xr-x | src/categorydata | 20 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/categories b/src/categories new file mode 100755 index 0000000..a054069 --- /dev/null +++ b/src/categories @@ -0,0 +1,20 @@ +#!/bin/sh +set -euo pipefail + + +usage() { + echo 'Usage: categories DIRECTORY' +} + +DIRECTORY="${1:-}" +eval "$(assert-arg -- "$DIRECTORY" 'DIRECTORY')" + +listall() { + find "$DIRECTORY"/category.*.*.sortdata | cut -d. -f2 | sort | uniq +} + +for category in `listall`; do + out="$DIRECTORY"/categories."$category".sortdata + cat "$DIRECTORY"/category."$category".*.sortdata > "$out" + printf '%s\n' "$out" +done diff --git a/src/categorydata b/src/categorydata new file mode 100755 index 0000000..faee5bf --- /dev/null +++ b/src/categorydata @@ -0,0 +1,20 @@ +#!/bin/sh +set -euo pipefail + + +usage() { + echo 'Usage: categorydata FILENAME.conf' +} + +FILENAME="${1:-}" +eval "$(assert-arg -- "$FILENAME" 'FILENAME.conf')" +. ./"$FILENAME" + + +DIR="$(dirname "$FILENAME")"/../../.. +for category in ${categories:-}; do + from="$DIR"/category."$category"."$date_iso"-"$sort".sortdata + to="$date_iso"-"$sort".sortdata + ln -fs "$to" "$from" + printf '%s\n' "$from" +done |
