changeset 2103:78a9140f02b1

Improve help for spr/chr formats by listing the :mc and :sc flags at their descriptions instead of -i option help.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 03 Apr 2019 20:59:36 +0300
parents e0281dae2cb8
children 1edf494226c6
files tools/gfxconv.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tools/gfxconv.c	Thu Mar 07 14:12:21 2019 +0200
+++ b/tools/gfxconv.c	Wed Apr 03 20:59:36 2019 +0300
@@ -79,16 +79,17 @@
     int flags;        // DM_FMT_* flags, see libgfx.h
     int type;         // Format type
     int format;       // Subformat identifier
+    char *help;
 } DMConvFormat;
 
 
 static const DMConvFormat baseFormatList[] =
 {
-    { "ASCII text"                           , "asc"   , DM_FMT_WR   , FFMT_ASCII  , 0 },
-    { "ANSI colored text"                    , "ansi"  , DM_FMT_WR   , FFMT_ANSI   , 0 },
-    { "C64 bitmap image"                     , NULL    , DM_FMT_RDWR , FFMT_BITMAP , -1  },
-    { "C64 character/font data"              , "chr"   , DM_FMT_RDWR , FFMT_CHAR   , 0 },
-    { "C64 sprite data"                      , "spr"   , DM_FMT_RDWR , FFMT_SPRITE , 0 },
+    { "ASCII text"                           , "asc"   , DM_FMT_WR   , FFMT_ASCII  , 0  , NULL },
+    { "ANSI colored text"                    , "ansi"  , DM_FMT_WR   , FFMT_ANSI   , 0  , NULL },
+    { "C64 bitmap image"                     , NULL    , DM_FMT_RDWR , FFMT_BITMAP , -1 , NULL  },
+    { "C64 character/font data"              , "chr"   , DM_FMT_RDWR , FFMT_CHAR   , 0  , " (chr:mc/chr:sc for multi/singlecolor)" },
+    { "C64 sprite data"                      , "spr"   , DM_FMT_RDWR , FFMT_SPRITE , 0  , " (spr:mc/spr:sc for multi/singlecolor)" },
 };
 
 static const int nbaseFormatList = sizeof(baseFormatList) / sizeof(baseFormatList[0]);
@@ -151,8 +152,8 @@
     { 15, 'v', "verbose",       "Increase verbosity", OPT_NONE },
     {  3, 'o', "output",        "Output filename", OPT_ARGREQ },
     {  4, 's', "skip",          "Skip N bytes in input from start (negative value will be offset from input end)", OPT_ARGREQ },
-    {  1, 'i', "informat",      "Set input format (spr[:mc|sc], chr[:mc|sc] or any supported image or C64 bitmap format, see --formats)", OPT_ARGREQ },
-    {  5, 'f', "format",        "Set output format (spr[:mc|sc], chr[:mc|sc] or any supported image or C64 bitmap format, see --formats)", OPT_ARGREQ },
+    {  1, 'i', "informat",      "Set input format (see --formats)", OPT_ARGREQ },
+    {  5, 'f', "format",        "Set output format (see --formats)", OPT_ARGREQ },
     { 17, 'F', "formats",       "List supported input/output formats", OPT_NONE },
     {  8, 'q', "sequential",    "Output sequential files (image output only)", OPT_NONE },
     {  6, 'm', "colormap",      "Set color index mapping (see below for information)", OPT_ARGREQ },
@@ -181,11 +182,12 @@
     for (int i = 0; i < nconvFormatList; i++)
     {
         const DMConvFormat *fmt = &convFormatList[i];
-        printf("%-6s| %c%c | %s\n",
+        printf("%-6s| %c%c | %s%s\n",
             fmt->fext ? fmt->fext : "",
             (fmt->flags & DM_FMT_RD) ? 'R' : ' ',
             (fmt->flags & DM_FMT_WR) ? 'W' : ' ',
-            fmt->name);
+            fmt->name,
+            fmt->help != NULL ? fmt->help : "");
     }
 
     printf(