Rename the RGBGFX --output-* options to --auto-* (#1245)

Fixes #1243
This commit is contained in:
Rangi
2023-11-21 11:52:16 -05:00
committed by GitHub
parent 482160ea04
commit f5ae6a80f0
4 changed files with 36 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ _rgbgfx_completions() {
[v]="verbose:normal" [v]="verbose:normal"
[Z]="columns:normal" [Z]="columns:normal"
[a]="attr-map:glob-*.attrmap" [a]="attr-map:glob-*.attrmap"
[A]="output-attr-map:normal" [A]="auto-attr-map:normal"
[b]="base-tiles:unk" [b]="base-tiles:unk"
[d]="depth:unk" [d]="depth:unk"
[L]="slice:unk" [L]="slice:unk"
@@ -23,13 +23,13 @@ _rgbgfx_completions() {
[n]="nb-palettes:unk" [n]="nb-palettes:unk"
[o]="output:glob-*.2bpp" [o]="output:glob-*.2bpp"
[p]="palette:glob-*.pal" [p]="palette:glob-*.pal"
[P]="output-palette:normal" [P]="auto-palette:normal"
[q]="palette-map:glob-*.palmap" [q]="palette-map:glob-*.palmap"
[Q]="output-palette-map:normal" [Q]="auto-palette-map:normal"
[r]="reverse:unk" [r]="reverse:unk"
[s]="palette-size:unk" [s]="palette-size:unk"
[t]="tilemap:glob-*.tilemap" [t]="tilemap:glob-*.tilemap"
[T]="output-tilemap:normal" [T]="auto-tilemap:normal"
[x]="trim-end:unk" [x]="trim-end:unk"
) )
# Parse command-line up to current word # Parse command-line up to current word

View File

@@ -13,29 +13,29 @@ local args=(
# Arguments are listed here in the same order as in the manual, except for the version # Arguments are listed here in the same order as in the manual, except for the version
'(- : * options)'{-V,--version}'[Print version number]' '(- : * options)'{-V,--version}'[Print version number]'
'(-a --attr-map -A --output-attr-map)'{-A,--output-attr-map}'[Shortcut for -a <file>.attrmap]' '(-a --attr-map -A --auto-attr-map)'{-A,--auto-attr-map}'[Shortcut for -a <file>.attrmap]'
'(-C --color-curve)'{-C,--color-curve}'[Generate palettes using GBC color curve]' '(-C --color-curve)'{-C,--color-curve}'[Generate palettes using GBC color curve]'
'(-m --mirror-tiles)'{-m,--mirror-tiles}'[Eliminate mirrored tiles from output]' '(-m --mirror-tiles)'{-m,--mirror-tiles}'[Eliminate mirrored tiles from output]'
'(-O --group-outputs)'{-O,--group-outputs}'[Base "shortcut" options on the output path, not input]' '(-O --group-outputs)'{-O,--group-outputs}'[Base "shortcut" options on the output path, not input]'
'(-p --palette -P --output-palette)'{-P,--output-palette}'[Shortcut for -p <file>.pal]' '(-p --palette -P --auto-palette)'{-P,--auto-palette}'[Shortcut for -p <file>.pal]'
'(-q --palette-map -Q --output-palette-map)'{-Q,--output-palette-map}'[Shortcut for -p <file>.palmap]' '(-q --palette-map -Q --auto-palette-map)'{-Q,--auto-palette-map}'[Shortcut for -p <file>.palmap]'
'(-t --tilemap -T --output-tilemap)'{-T,--output-tilemap}'[Shortcut for -t <file>.tilemap]' '(-t --tilemap -T --auto-tilemap)'{-T,--auto-tilemap}'[Shortcut for -t <file>.tilemap]'
'(-u --unique-tiles)'{-u,--unique-tiles}'[Eliminate redundant tiles]' '(-u --unique-tiles)'{-u,--unique-tiles}'[Eliminate redundant tiles]'
{-v,--verbose}'[Enable verbose output]' {-v,--verbose}'[Enable verbose output]'
'(-h --horizontal -Z --columns)'{-Z,--columns}'[Read the image in column-major order]' '(-h --horizontal -Z --columns)'{-Z,--columns}'[Read the image in column-major order]'
'(-a --attr-map -A --output-attr-map)'{-a,--attr-map}'+[Generate a map of tile attributes (mirroring)]:attrmap file:_files' '(-a --attr-map -A --auto-attr-map)'{-a,--attr-map}'+[Generate a map of tile attributes (mirroring)]:attrmap file:_files'
'(-b --base-tiles)'{-b,--base-tiles}'+[Base tile IDs for tile map output]:base tile IDs:' '(-b --base-tiles)'{-b,--base-tiles}'+[Base tile IDs for tile map output]:base tile IDs:'
'(-d --depth)'{-d,--depth}'+[Set bit depth]:bit depth:_depths' '(-d --depth)'{-d,--depth}'+[Set bit depth]:bit depth:_depths'
'(-L --slice)'{-L,--slice}'+[Only process a portion of the image]:input slice:' '(-L --slice)'{-L,--slice}'+[Only process a portion of the image]:input slice:'
'(-N --nb-tiles)'{-N,--nb-tiles}'+[Limit number of tiles]:tile count:' '(-N --nb-tiles)'{-N,--nb-tiles}'+[Limit number of tiles]:tile count:'
'(-n --nb-palettes)'{-n,--nb-palettes}'+[Limit number of palettes]:palette count:' '(-n --nb-palettes)'{-n,--nb-palettes}'+[Limit number of palettes]:palette count:'
'(-o --output)'{-o,--output}'+[Set output file]:output file:_files' '(-o --output)'{-o,--output}'+[Set output file]:output file:_files'
'(-p --palette -P --output-palette)'{-p,--palette}"+[Output the image's palette in little-endian native RGB555 format]:palette file:_files" '(-p --palette -P --auto-palette)'{-p,--palette}"+[Output the image's palette in little-endian native RGB555 format]:palette file:_files"
'(-q --palette-map -Q --output-palette-map)'{-q,--palette-map}"+[Output the image's palette map]:palette map file:_files" '(-q --palette-map -Q --auto-palette-map)'{-q,--palette-map}"+[Output the image's palette map]:palette map file:_files"
'(-r --reverse)'{-r,--reverse}'+[Yield an image from binary data]:image width (in tiles):' '(-r --reverse)'{-r,--reverse}'+[Yield an image from binary data]:image width (in tiles):'
'(-s --palette-size)'{-s,--palette-size}'+[Limit palette size]:palette size:' '(-s --palette-size)'{-s,--palette-size}'+[Limit palette size]:palette size:'
'(-t --tilemap -T --output-tilemap)'{-t,--tilemap}'+[Generate a map of tile indices]:tilemap file:_files' '(-t --tilemap -T --auto-tilemap)'{-t,--tilemap}'+[Generate a map of tile indices]:tilemap file:_files'
'(-x --trim-end)'{-x,--trim-end}'+[Trim end of output by this many tiles]:tile count:' '(-x --trim-end)'{-x,--trim-end}'+[Trim end of output by this many tiles]:tile count:'
":input png file:_files -g '*.png'" ":input png file:_files -g '*.png'"

View File

@@ -98,7 +98,7 @@ The output is written just like the tile map (see
follows the same order follows the same order
.Pq Fl Z , .Pq Fl Z ,
and has the same size. and has the same size.
.It Fl A , Fl Fl output-attr-map .It Fl A , Fl Fl auto-attr-map
Same as Same as
.Fl a Ar base_path Ns .attrmap .Fl a Ar base_path Ns .attrmap
.Pq see Sx Automatic output paths . .Pq see Sx Automatic output paths .
@@ -217,14 +217,14 @@ Output the tile data in native 2bpp format or in 1bpp
to this file. to this file.
.It Fl p Ar pal_file , Fl Fl palette Ar pal_file .It Fl p Ar pal_file , Fl Fl palette Ar pal_file
Output the image's palette set to this file. Output the image's palette set to this file.
.It Fl P , Fl Fl output-palette .It Fl P , Fl Fl auto-palette
Same as Same as
.Fl p Ar base_path Ns .pal .Fl p Ar base_path Ns .pal
.Pq see Sx Automatic output paths . .Pq see Sx Automatic output paths .
.It Fl q Ar pal_file , Fl Fl palette-map Ar pal_file .It Fl q Ar pal_file , Fl Fl palette-map Ar pal_file
Output the image's palette map to this file. Output the image's palette map to this file.
This is useful if the input image contains more than 8 palettes, as the attribute map only contains the lower 3 bits of the palette indices. This is useful if the input image contains more than 8 palettes, as the attribute map only contains the lower 3 bits of the palette indices.
.It Fl Q , Fl Fl output-palette-map .It Fl Q , Fl Fl auto-palette-map
Same as Same as
.Fl q Ar base_path Ns .palmap .Fl q Ar base_path Ns .palmap
.Pq see Sx Automatic output paths . .Pq see Sx Automatic output paths .
@@ -260,7 +260,7 @@ Useful in combination with
and/or and/or
.Fl m .Fl m
to keep track of duplicate tiles. to keep track of duplicate tiles.
.It Fl T , Fl Fl output-tilemap .It Fl T , Fl Fl auto-tilemap
Same as Same as
.Fl t Ar base_path Ns .tilemap .Fl t Ar base_path Ns .tilemap
.Pq see Sx Automatic output paths . .Pq see Sx Automatic output paths .

View File

@@ -113,7 +113,8 @@ static char const *optstring = "-Aa:b:Cc:Dd:FfhL:mN:n:Oo:Pp:Qq:r:s:Tt:U:uVvx:Z";
* over short opt matching * over short opt matching
*/ */
static struct option const longopts[] = { static struct option const longopts[] = {
{"output-attr-map", no_argument, NULL, 'A'}, {"auto-attr-map", no_argument, NULL, 'A'},
{"output-attr-map", no_argument, NULL, -'A'}, // Deprecated
{"attr-map", required_argument, NULL, 'a'}, {"attr-map", required_argument, NULL, 'a'},
{"base-tiles", required_argument, NULL, 'b'}, {"base-tiles", required_argument, NULL, 'b'},
{"color-curve", no_argument, NULL, 'C'}, {"color-curve", no_argument, NULL, 'C'},
@@ -129,12 +130,15 @@ static struct option const longopts[] = {
{"nb-palettes", required_argument, NULL, 'n'}, {"nb-palettes", required_argument, NULL, 'n'},
{"group-outputs", no_argument, NULL, 'O'}, {"group-outputs", no_argument, NULL, 'O'},
{"output", required_argument, NULL, 'o'}, {"output", required_argument, NULL, 'o'},
{"output-palette", no_argument, NULL, 'P'}, {"auto-palette", no_argument, NULL, 'P'},
{"output-palette", no_argument, NULL, -'P'}, // Deprecated
{"palette", required_argument, NULL, 'p'}, {"palette", required_argument, NULL, 'p'},
{"output-palette-map", no_argument, NULL, 'Q'}, {"auto-palette-map", no_argument, NULL, 'Q'},
{"output-palette-map", no_argument, NULL, -'Q'}, // Deprecated
{"palette-map", required_argument, NULL, 'q'}, {"palette-map", required_argument, NULL, 'q'},
{"reverse", required_argument, NULL, 'r'}, {"reverse", required_argument, NULL, 'r'},
{"output-tilemap", no_argument, NULL, 'T'}, {"auto-tilemap", no_argument, NULL, 'T'},
{"output-tilemap", no_argument, NULL, -'T'}, // Deprecated
{"tilemap", required_argument, NULL, 't'}, {"tilemap", required_argument, NULL, 't'},
{"unit-size", required_argument, NULL, 'U'}, {"unit-size", required_argument, NULL, 'U'},
{"unique-tiles", no_argument, NULL, 'u'}, {"unique-tiles", no_argument, NULL, 'u'},
@@ -341,6 +345,9 @@ static char *parseArgv(int argc, char **argv) {
for (int ch; (ch = musl_getopt_long_only(argc, argv, optstring, longopts, nullptr)) != -1;) { for (int ch; (ch = musl_getopt_long_only(argc, argv, optstring, longopts, nullptr)) != -1;) {
char *arg = musl_optarg; // Make a copy for scanning char *arg = musl_optarg; // Make a copy for scanning
switch (ch) { switch (ch) {
case -'A':
warning("`--output-attr-map` is deprecated, use `--auto-attr-map` instead");
[[fallthrough]];
case 'A': case 'A':
localOptions.autoAttrmap = true; localOptions.autoAttrmap = true;
break; break;
@@ -497,6 +504,9 @@ static char *parseArgv(int argc, char **argv) {
warning("Overriding tile data file %s", options.output->c_str()); warning("Overriding tile data file %s", options.output->c_str());
options.output = musl_optarg; options.output = musl_optarg;
break; break;
case -'P':
warning("`--output-palette` is deprecated, use `--auto-palette` instead");
[[fallthrough]];
case 'P': case 'P':
localOptions.autoPalettes = true; localOptions.autoPalettes = true;
break; break;
@@ -506,6 +516,9 @@ static char *parseArgv(int argc, char **argv) {
warning("Overriding palettes file %s", options.palettes->c_str()); warning("Overriding palettes file %s", options.palettes->c_str());
options.palettes = musl_optarg; options.palettes = musl_optarg;
break; break;
case -'Q':
warning("`--output-palette-map` is deprecated, use `--auto-palette-map` instead");
[[fallthrough]];
case 'Q': case 'Q':
localOptions.autoPalmap = true; localOptions.autoPalmap = true;
break; break;
@@ -535,6 +548,9 @@ static char *parseArgv(int argc, char **argv) {
error("Palette size (-s) may not be 0!"); error("Palette size (-s) may not be 0!");
} }
break; break;
case -'T':
warning("`--output-tilemap` is deprecated, use `--auto-tilemap` instead");
[[fallthrough]];
case 'T': case 'T':
localOptions.autoTilemap = true; localOptions.autoTilemap = true;
break; break;