summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-03 08:02:14 +0300
committerPaul Buetow <paul@buetow.org>2026-06-03 08:02:14 +0300
commitf0783ce8b602aeee411843e79363c3b97c3bbfaa (patch)
tree95093312a9e48cf6a242007994cf874ef26df1d6
parent5fd1c35675d64642b82177f7d6e7235be5372915 (diff)
ni0: update CLI and config documentation
-rw-r--r--README.md84
-rwxr-xr-xbin/photoalbum1
-rwxr-xr-xsrc/photoalbum.sh1
3 files changed, 55 insertions, 31 deletions
diff --git a/README.md b/README.md
index f33e4df..921ce84 100644
--- a/README.md
+++ b/README.md
@@ -5,54 +5,76 @@ The resulting static photo album is pure HTML+CSS (without any JavaScript!).
## Installation
-Run the following commands to install it:
+Build and install the command, templates, and default config from a source
+checkout with:
```
make
sudo make install
```
-Also, as a requirement, ImageMagick needs to be installed. The script prefers the
+ImageMagick must also be installed. The script prefers the
modern `magick` command and falls back to `convert` when needed.
## Usage
```
- photoalbum --generate [--config PATH] [OPTIONS]
- photoalbum --clean [--config PATH] [OPTIONS]
- photoalbum --version
- photoalbum --init
+photoalbum --init
+photoalbum --generate [--config PATH] [OPTIONS]
+photoalbum --clean [--config PATH] [OPTIONS]
+photoalbum --version
```
-* `--generate`: Generates the static photo album
-* `--clean`: Cleans up the workspace
-* `--config PATH`: Selects the config file for `--generate` or `--clean`
-* `--version`: Prints out the version
-* `--init`: Creates a `photoalbum.conf` in the current working directory
-
-The following long options can be used with `--generate` or `--clean` to
-override values loaded from `photoalbum.conf`:
-
-* `--incoming PATH`: Overrides `INCOMING_DIR`
-* `--dist PATH`: Overrides `DIST_DIR`
-* `--template PATH`: Overrides `TEMPLATE_DIR`
-* `--title TEXT`: Overrides `TITLE`
-* `--height VALUE`: Overrides `HEIGHT`
-* `--thumbheight VALUE`: Overrides `THUMBHEIGHT`
-* `--maxpreviews N`: Overrides `MAXPREVIEWS`
-* `--shuffle`: Sets `SHUFFLE=yes`
-* `--no-shuffle`: Sets `SHUFFLE=no`
-* `--tarball`: Sets `TARBALL_INCLUDE=yes`
-* `--no-tarball`: Sets `TARBALL_INCLUDE=no`
+* `--init` creates `./photoalbum.conf` in the current working directory from the
+ default config. It refuses to overwrite an existing file.
+* `--generate` builds the static album.
+* `--clean` removes the configured output directory.
+* `--version` prints the program version.
+* `--config PATH` selects the config file for `--generate` or `--clean`.
+
+When `--config PATH` is not provided, `--generate` and `--clean` read
+`./photoalbum.conf`. If the file is missing, run `photoalbum --init` first.
+
+The config file is a Bash file with assignments such as `INCOMING_DIR`,
+`DIST_DIR`, `TEMPLATE_DIR`, `TITLE`, `HEIGHT`, `THUMBHEIGHT`, `MAXPREVIEWS`,
+`SHUFFLE`, and `TARBALL_INCLUDE`.
+
+Before generating, `photoalbum` validates the loaded config and command-line
+overrides. It checks required values, positive integer settings, `yes`/`no`
+settings, readable input and template directories, a writable output location,
+and ImageMagick availability. Generation stops before writing album output when
+validation fails.
+
+The following long options override config values:
+
+| Option | Config value |
+| --- | --- |
+| `--incoming PATH` | `INCOMING_DIR` |
+| `--dist PATH` | `DIST_DIR` |
+| `--template PATH` | `TEMPLATE_DIR` |
+| `--title TEXT` | `TITLE` |
+| `--height VALUE` | `HEIGHT` |
+| `--thumbheight VALUE` | `THUMBHEIGHT` |
+| `--maxpreviews N` | `MAXPREVIEWS` |
+| `--shuffle` | `SHUFFLE=yes` |
+| `--no-shuffle` | `SHUFFLE=no` |
+| `--tarball` | `TARBALL_INCLUDE=yes` |
+| `--no-tarball` | `TARBALL_INCLUDE=no` |
+
+`--clean` accepts the same override options, but only `--dist` changes what it
+removes.
## Example usage
-1. Run `photoalbum --init`, which creates a `photoalbum.conf` file in the current directory from the installed/default config template.
-2. Adjust the `INCOMING_DIR` path in `photoalbum.conf`. Point it to a directory with all the pictures in it.
-3. Run `photoalbum --generate` to generate it.
+1. Run `photoalbum --init`.
+2. Edit `photoalbum.conf`. Set `INCOMING_DIR` to the directory containing the
+ pictures and adjust `DIST_DIR`, `TITLE`, or template settings as needed.
+3. Run `photoalbum --generate` to generate the album.
4. Distribute the `./dist` directory to a static web server.
-5. Clean the mess up with `photoalbum --clean`
+5. Run `photoalbum --clean` to remove the generated output.
## HTML templates
-Poke around in this source directory. You will find a bunch of Bash-HTML template files. You could tweak them to your likings.
+Templates live under `share/templates/default` in the source tree and under the
+installed template directory after installation. Copy and edit them, then point
+`TEMPLATE_DIR` or `--template PATH` at the customized directory.
diff --git a/bin/photoalbum b/bin/photoalbum
index b4368f9..03d017b 100755
--- a/bin/photoalbum
+++ b/bin/photoalbum
@@ -16,6 +16,7 @@ usage() {
$0 --init
Options:
+ --config PATH
--incoming PATH
--dist PATH
--template PATH
diff --git a/src/photoalbum.sh b/src/photoalbum.sh
index c5252f8..9cb17a8 100755
--- a/src/photoalbum.sh
+++ b/src/photoalbum.sh
@@ -16,6 +16,7 @@ usage() {
$0 --init
Options:
+ --config PATH
--incoming PATH
--dist PATH
--template PATH