From 13dcd97685772ad76cf0c6bf7870bdb26b62433f Mon Sep 17 00:00:00 2001 From: Ben Wiley Sittler Date: Tue, 4 Nov 2008 03:36:33 +0000 Subject: [PATCH] list available import formats in usage message --- caca-php/examples/import.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/caca-php/examples/import.php b/caca-php/examples/import.php index e81e959..4f0e5be 100755 --- a/caca-php/examples/import.php +++ b/caca-php/examples/import.php @@ -18,10 +18,16 @@ * http://sam.zoy.org/wtfpl/COPYING for more details. */ -if($argc < 2) +$imports = caca_get_import_list(); + +if($argc < 2 || $argc > 3) { - die($argv[0] . ": missing argument (filename).\n" . - "usage: " . $argv[0] . " []\n"); + $msg = ($argv[0] . ": wrong argument count\n" . + "usage: " . $argv[0] . " file []\n" . + "where is one of:\n"); + foreach($imports as $format => $name) + $msg .= " \"" . $name . "\" (" . $format . ")\n"; + die($msg); } $cv = caca_create_canvas(0, 0);