stapix

Yet another static page generator for photo galleries

Commit
2f58377cbb6c5c4222e70ac933454bb697243edb
Parent
8d3cc29bc745310caf854fecb8c7b5aebe62644e
Author
Pablo <pablo-escobar@riseup.net>
Date

Added a help snippet for the YAML format of the config files

Diffstat

1 file changed, 10 insertions, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified src/main.rs 11 10 1
diff --git a/src/main.rs b/src/main.rs
@@ -47,8 +47,8 @@ fn main() -> io::Result<()> {
         },
         // Error parsing the config file
         Ok(Err(err)) => {
-            // TODO: Print a message explaining the format of the config file
             eprintln!("ERROR: Couldn't parse {config:?}: {err}");
+            usage_config();
             exit(1)
         },
         Ok(Ok(pic_infos)) => render_gallery(pic_infos),
@@ -276,3 +276,12 @@ fn write_license(f: &mut File) -> io::Result<()> {
 fn usage(program: &str) {
     eprintln!("Usage: {program} config.yml");
 }
+
+fn usage_config() {
+    eprintln!("Usage: The YAML configuration file should look like this:\n");
+    eprintln!("   - path: ./path/to/first.jpg");
+    eprintln!("     alt: \"Text alternative for the first photo\"");
+    eprintln!("   - path: ./path/to/second.png");
+    eprintln!("     alt: \"Text alternative for the second photo\"");
+    eprintln!("   ...");
+}