diff --git a/doit b/doit index d06ccce..36259b4 100755 --- a/doit +++ b/doit @@ -35,14 +35,35 @@ runsync() { rsync -have ssh $OUTPATH/ $SERVPATH } -while getopts "bcs" flag; do +dostats() { + [ -d $OUTPATH ] + echo -e "Used space:" + echo -e " ├── content: $(du -hs content | cut -f1)" + echo -e " ├── output: $(du -hs $OUTPATH | cut -f1)" + echo -e " └── all: $(du -hs . | cut -f1)" + echo + echo -e "File types:" + echo -e " ├── total: $(find $OUTPATH -type f | wc -l)" + echo -e " ├── total known: $(find $OUTPATH -type f | grep -iE '\.(jpg|png|webp|gif|ico|css|php|html)' | wc -l)" + echo -e " ├── HTML: $(find $OUTPATH -type f -iname '*.html' | wc -l)" + echo -e " ├── CSS: $(find $OUTPATH -type f -iname '*.css' | wc -l)" + echo -e " ├── PHP: $(find $OUTPATH -type f -iname '*.php' | wc -l)" + echo -e " ├── images: $(find $OUTPATH -type f | grep -iE '\.(jpg|png|webp|gif|ico)' | wc -l)" + echo -e " └── other:" + find $OUTPATH -type f | rev | cut -d. -f1 | rev | sort | uniq -c | grep -viE 'html|css|php|jpg|png|webp|gif|ico' | awk '{ print " ├── " $2 ": " $1 }' + echo -e " └── total: $(find $OUTPATH -type f | rev | cut -d. -f1 | rev | sort | grep -viE 'html|php|jpg|png|webp|gif|css|ico' | wc -l)" +} + +while getopts "bcsS" flag; do case ${flag} in b) dobuild=y;; c) doclean=y;; s) dosync=y;; + S) dostats=y;; esac done [ -v doclean ] && rm -rfv output ||: [ -v dobuild ] && runbuild [ -v dosync ] && runsync || true +[ -v dostats ] && dostats