From f5ae6a80f00366e5e567400ca42379d90a475824 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:52:16 -0500 Subject: [PATCH] Rename the RGBGFX `--output-*` options to `--auto-*` (#1245) Fixes #1243 --- contrib/bash_compl/_rgbgfx.bash | 8 ++++---- contrib/zsh_compl/_rgbgfx | 16 ++++++++-------- man/rgbgfx.1 | 8 ++++---- src/gfx/main.cpp | 24 ++++++++++++++++++++---- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/contrib/bash_compl/_rgbgfx.bash b/contrib/bash_compl/_rgbgfx.bash index 8b7a9248..6463ee14 100755 --- a/contrib/bash_compl/_rgbgfx.bash +++ b/contrib/bash_compl/_rgbgfx.bash @@ -15,7 +15,7 @@ _rgbgfx_completions() { [v]="verbose:normal" [Z]="columns:normal" [a]="attr-map:glob-*.attrmap" - [A]="output-attr-map:normal" + [A]="auto-attr-map:normal" [b]="base-tiles:unk" [d]="depth:unk" [L]="slice:unk" @@ -23,13 +23,13 @@ _rgbgfx_completions() { [n]="nb-palettes:unk" [o]="output:glob-*.2bpp" [p]="palette:glob-*.pal" - [P]="output-palette:normal" + [P]="auto-palette:normal" [q]="palette-map:glob-*.palmap" - [Q]="output-palette-map:normal" + [Q]="auto-palette-map:normal" [r]="reverse:unk" [s]="palette-size:unk" [t]="tilemap:glob-*.tilemap" - [T]="output-tilemap:normal" + [T]="auto-tilemap:normal" [x]="trim-end:unk" ) # Parse command-line up to current word diff --git a/contrib/zsh_compl/_rgbgfx b/contrib/zsh_compl/_rgbgfx index 5d179794..809cb213 100644 --- a/contrib/zsh_compl/_rgbgfx +++ b/contrib/zsh_compl/_rgbgfx @@ -13,29 +13,29 @@ local args=( # Arguments are listed here in the same order as in the manual, except for the version '(- : * options)'{-V,--version}'[Print version number]' - '(-a --attr-map -A --output-attr-map)'{-A,--output-attr-map}'[Shortcut for -a .attrmap]' + '(-a --attr-map -A --auto-attr-map)'{-A,--auto-attr-map}'[Shortcut for -a .attrmap]' '(-C --color-curve)'{-C,--color-curve}'[Generate palettes using GBC color curve]' '(-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]' - '(-p --palette -P --output-palette)'{-P,--output-palette}'[Shortcut for -p .pal]' - '(-q --palette-map -Q --output-palette-map)'{-Q,--output-palette-map}'[Shortcut for -p .palmap]' - '(-t --tilemap -T --output-tilemap)'{-T,--output-tilemap}'[Shortcut for -t .tilemap]' + '(-p --palette -P --auto-palette)'{-P,--auto-palette}'[Shortcut for -p .pal]' + '(-q --palette-map -Q --auto-palette-map)'{-Q,--auto-palette-map}'[Shortcut for -p .palmap]' + '(-t --tilemap -T --auto-tilemap)'{-T,--auto-tilemap}'[Shortcut for -t .tilemap]' '(-u --unique-tiles)'{-u,--unique-tiles}'[Eliminate redundant tiles]' {-v,--verbose}'[Enable verbose output]' '(-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:' '(-d --depth)'{-d,--depth}'+[Set bit depth]:bit depth:_depths' '(-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-palettes)'{-n,--nb-palettes}'+[Limit number of palettes]:palette count:' '(-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" - '(-q --palette-map -Q --output-palette-map)'{-q,--palette-map}"+[Output the image's palette map]:palette map 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 --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):' '(-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:' ":input png file:_files -g '*.png'" diff --git a/man/rgbgfx.1 b/man/rgbgfx.1 index f5514e25..d103c6f7 100644 --- a/man/rgbgfx.1 +++ b/man/rgbgfx.1 @@ -98,7 +98,7 @@ The output is written just like the tile map (see follows the same order .Pq Fl Z , and has the same size. -.It Fl A , Fl Fl output-attr-map +.It Fl A , Fl Fl auto-attr-map Same as .Fl a Ar base_path Ns .attrmap .Pq see Sx Automatic output paths . @@ -217,14 +217,14 @@ Output the tile data in native 2bpp format or in 1bpp to this file. .It Fl p Ar pal_file , Fl Fl palette Ar pal_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 .Fl p Ar base_path Ns .pal .Pq see Sx Automatic output paths . .It Fl q Ar pal_file , Fl Fl palette-map Ar pal_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. -.It Fl Q , Fl Fl output-palette-map +.It Fl Q , Fl Fl auto-palette-map Same as .Fl q Ar base_path Ns .palmap .Pq see Sx Automatic output paths . @@ -260,7 +260,7 @@ Useful in combination with and/or .Fl m to keep track of duplicate tiles. -.It Fl T , Fl Fl output-tilemap +.It Fl T , Fl Fl auto-tilemap Same as .Fl t Ar base_path Ns .tilemap .Pq see Sx Automatic output paths . diff --git a/src/gfx/main.cpp b/src/gfx/main.cpp index b7beb7b9..c74921a2 100644 --- a/src/gfx/main.cpp +++ b/src/gfx/main.cpp @@ -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 */ 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'}, {"base-tiles", required_argument, NULL, 'b'}, {"color-curve", no_argument, NULL, 'C'}, @@ -129,12 +130,15 @@ static struct option const longopts[] = { {"nb-palettes", required_argument, NULL, 'n'}, {"group-outputs", no_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'}, - {"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'}, {"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'}, {"unit-size", required_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;) { char *arg = musl_optarg; // Make a copy for scanning switch (ch) { + case -'A': + warning("`--output-attr-map` is deprecated, use `--auto-attr-map` instead"); + [[fallthrough]]; case 'A': localOptions.autoAttrmap = true; break; @@ -497,6 +504,9 @@ static char *parseArgv(int argc, char **argv) { warning("Overriding tile data file %s", options.output->c_str()); options.output = musl_optarg; break; + case -'P': + warning("`--output-palette` is deprecated, use `--auto-palette` instead"); + [[fallthrough]]; case 'P': localOptions.autoPalettes = true; break; @@ -506,6 +516,9 @@ static char *parseArgv(int argc, char **argv) { warning("Overriding palettes file %s", options.palettes->c_str()); options.palettes = musl_optarg; break; + case -'Q': + warning("`--output-palette-map` is deprecated, use `--auto-palette-map` instead"); + [[fallthrough]]; case 'Q': localOptions.autoPalmap = true; break; @@ -535,6 +548,9 @@ static char *parseArgv(int argc, char **argv) { error("Palette size (-s) may not be 0!"); } break; + case -'T': + warning("`--output-tilemap` is deprecated, use `--auto-tilemap` instead"); + [[fallthrough]]; case 'T': localOptions.autoTilemap = true; break;