stapix

Yet another static page generator for photo galleries

Commit
06e5254b892545ac5bcaaa54b40bf3998fdade38
Parent
3aa8447ae0df0e8cfa086b69ca44c25df1710ac0
Author
Pablo <pablo-escobar@riseup.net>
Date

Added code to print the usage information

Diffstat

1 file changed, 6 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/main.rs 8 6 2
diff --git a/src/main.rs b/src/main.rs
@@ -14,13 +14,13 @@ fn main() -> io::Result<()> {
     let config = match args.len() {
         2 => &args[1],
         1 => {
-            // TODO: Print usage info
             eprintln!("ERROR: Expected one command line argument, found none");
+            usage();
             exit(1)
         },
         _ => {
-            // TODO: Print usage info
             eprintln!("ERROR: Expected one command line argument, found many");
+            usage();
             exit(1)
         },
     };
@@ -188,3 +188,7 @@ fn print_license(f: &mut File) -> io::Result<()> {
     writeln!(f, "     You should have received a copy of the GNU General Public License")?;
     writeln!(f, "     along with this program. If not, see <https://www.gnu.org/licenses/>. -->")
 }
+
+fn usage() {
+    eprintln!("USAGE: yaggen config.yml");
+}