#!/bin/sh # wsctl - scripts for general admin of the website usage() { echo "wsctl [gen-wr-index | gen-wr-index-html | ls | today | week]" } list() { header="date\ttype\twc\ttitle\n" for f in $(find $WWW_DEFAULT_PATH/src/wv \ $WWW_DEFAULT_PATH/src/poetry $WWW_DEFAULT_PATH/src/prose \ $WWW_DEFAULT_PATH/src/blog -type f | sort -k 3) ; do out="$out$(sed -n 2p $f) $(basename "$(dirname "$f")") $(wc -w "$f" | awk '{print $1}') $(sed -n 1p $f)\n" done out="$header$(printf "$out" | sort -rk 1)\n" printf "$out" } gen_wr_idx() { header="date type title\n" for f in $(find $WWW_DEFAULT_PATH/src/wv \ $WWW_DEFAULT_PATH/src/poetry $WWW_DEFAULT_PATH/src/prose \ $WWW_DEFAULT_PATH/src/blog -type f | sort -k 3) ; do out="$out$(sed -n 2p $f) $(basename "$(dirname "$f")") $(sed -n 1p $f)\n" done out="$header$(printf "$out" | sort -rk 1)\n" printf "$out" } gen_wr_idx_html() { header="
date | type | title |
---|---|---|
$(sed -n 2p $f) | $type | $(sed -n 1p $f) |