Skip to content

Simplify --help output for new CLI? #12253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dbaston opened this issue May 2, 2025 · 0 comments
Open

Simplify --help output for new CLI? #12253

dbaston opened this issue May 2, 2025 · 0 comments
Labels
enhancement gdal_cli Anything related to the new 3.11 "gdal" CLI frontend

Comments

@dbaston
Copy link
Member

dbaston commented May 2, 2025

Feature description

I'm working on a gdal raster reclassify utility for the new CLI. It has three arguments: the input/output datasets, and a table to define the reclassification. Looking at the output of --help, it's a bit difficult to spot this:

Usage: gdal raster reclassify [OPTIONS] <INPUT> <OUTPUT>

Reclassify values in a raster dataset

Positional arguments:
  -i, --input <INPUT>                                      Input raster dataset [required]
  -o, --output <OUTPUT>                                    Output raster dataset [required]

Common Options:
  -h, --help                                               Display help message and exit
  --version                                                Display GDAL version and exit
  --json-usage                                             Display usage as JSON document and exit
  --drivers                                                Display driver list as JSON document and exit
  --config <KEY>=<VALUE>                                   Configuration option [may be repeated]
  --progress                                               Display progress bar

Options:
  -f, --of, --format, --output-format <OUTPUT-FORMAT>      Output format ("GDALG" allowed)
  --co, --creation-option <KEY>=<VALUE>                    Creation option [may be repeated]
  --overwrite                                              Whether overwriting existing output is allowed
  -m, --mapping <MAPPING>                                  Reclassification mappings (or specify a @<filename> to point to a file containing mappings [required]
  --ot, --datatype, --output-data-type <OUTPUT-DATA-TYPE>  Output data type. OUTPUT-DATA-TYPE=Byte|Int8|UInt16|Int16|UInt32|Int32|UInt64|Int64|CInt16|CInt32|Float16|Float32|Float64|CFloat32|CFloat64

Advanced Options:
  --if, --input-format <INPUT-FORMAT>                      Input formats [may be repeated]
  --oo, --open-option <KEY>=<VALUE>                        Open options [may be repeated]

For more details, consult https://gdal.org/programs/gdal_raster_reclassify.html

WARNING: the gdal command is provisionally provided as an alternative interface to GDAL and OGR command line utilities.
The project reserves the right to modify, rename, reorganize, and change the behavior of the utility
until it is officially frozen in a future feature release of GDAL.

Some thoughts:

  • The only option that is specific to this program is "--mapping". Could we make the options that are unique to a particular program more obvious?
  • The distinction between "options" , "common options", and "advanced options" isn't obvious. For example "--oo" is an "advanced option", but "--co" is an "option", and "--config" is a "common option". One could argue that everything except --mapping is a "common option"
  • Does every utility need --drivers and --version, or can those only be documented at the root level (gdal --drivers or gdal raster --drivers but not gdal raster reclassify --drivers)
  • Four alternative ways to write --output-format and three to write --output-data-type is a lot.

Additional context

No response

@dbaston dbaston added enhancement gdal_cli Anything related to the new 3.11 "gdal" CLI frontend labels May 2, 2025
rouault added a commit to rouault/gdal that referenced this issue May 2, 2025
rouault added a commit to rouault/gdal that referenced this issue May 2, 2025
rouault added a commit to rouault/gdal that referenced this issue May 3, 2025
rouault added a commit to rouault/gdal that referenced this issue May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement gdal_cli Anything related to the new 3.11 "gdal" CLI frontend
Projects
None yet
Development

No branches or pull requests

1 participant