t* Simple Justified Gallery
       
   URI git clone git://git.codevoid.de/mkpicindex
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
   DIR commit f0175a7ee17921abd67f45c3a2eb269cf3565160
   DIR parent c689653652b10f69f0955045bf8d860643aadb42
   URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de>
       Date:   Sun, 27 Oct 2019 14:42:02 +0100
       
       Support CLI Options
       
       Diffstat:
         M Makefile                            |       2 +-
         M mkpicindex-static.sh                |      41 ++++++++++++++++++++++++++++---
       
       2 files changed, 39 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/Makefile b/Makefile
       t@@ -1,6 +1,6 @@
        all:
                ./mkpicindex.sh > index.html.tmp && mv index.html.tmp index.html
        static:
       -        ./mkpicindex-static.sh 0 > index.html.tmp && mv index.html.tmp index.html
       +        ./mkpicindex-static.sh > index.html.tmp && mv index.html.tmp index.html
        clean:
                rm -rf index.html.tmp index.html style.css justify.js LICENSE
   DIR diff --git a/mkpicindex-static.sh b/mkpicindex-static.sh
       t@@ -11,8 +11,8 @@ printf '%s' \
        
        # CONFIGURE
        TITLE="My Gallery"          # browser title
       -WIDTH=1000                  # how wide will the gallery be
       -ROW_HEIGHT=150              # how high will the justified rows be?
       +WIDTH=850                   # how wide will the gallery be
       +ROW_HEIGHT=180              # how high will the justified rows be?
        THUMB_QUALITY=83            # quality for thumbnails
        THUMB_PATH="thm"            # relative path to thumbnail folder
        THUMB_PADDING="6"           # image padding
       t@@ -21,6 +21,41 @@ THUMB_PADDING="6"           # image padding
        DEBUG=0                     # debug output
        THREADS=4
        
       +# PRINT HELP / USAGE TEXT
       +usage() {
       +    printf '%s\n' \
       +'Usage: mkpicindex [option] > outfile.html
       +    Options:
       +        -t "My Gallery"  - Title
       +        -w 850           - Width
       +        -h 180           - Row height
       +        -q 83            - Thumbnail quality
       +        -b 6             - Thumbnail border
       +        -p 8             - Max convert processes
       +        -d               - Debug mode
       +        -h               - This help
       +'
       +    exit 2
       +}
       +
       +# OVERIDE DEFAULTS
       +while getopts 't:w:h:b:q:p:d' c
       +do
       +  case $c in
       +    t) TITLE="$OPTARG" ;;
       +    w) WIDTH="$OPTARG" ;;
       +    h) ROW_HEIGHT="$OPTARG" ;;
       +    q) QUALITY="$OPTARG" ;;
       +    b) THUMB_PADDING="$OPTARG" ;;
       +    p) THREADS="$OPTARG" ;;
       +    d) DEBUG=1 ;;
       +    ?|*) usage; ;;
       +  esac
       +done
       +
       +# PRINT USAGE IF OUTPUT IS NOT REDIRECTED
       +[ "$DEBUG" != 1 ] && test -t 1 && usage;
       +
        # GLOBAL TMP VARIABLES
        G_ROW_WIDTH=0               # combined pic width   < WIDTH @ ROW_HEIGHT
        G_ROW_FILES=""              # pipe separated files < WIDTH
       t@@ -139,7 +174,7 @@ printf '%s\n' \
        '<html>
            <head>
            <meta name="viewport" content="width=device-width">
       -    <title>My Gallery</title>
       +    <title>'"$TITLE"'</title>
                <style>
                html {
                    background: black;