Skip to content

CLI: report missing flag values and non-numeric dimensions instead of silently ignoring them #2917

Done

Description

@giswqs

Summary

Several option parsers in apps/rustgis-cli/src/main.rs silently ignore missing or invalid values or consume a subsequent flag as a value:

  • opt() (main.rs:58-60) accepts a following --flag token as the value and returns None if no value follows (e.g. rustgis-cli run --sample --save --cmd 'map.zoomFull' writes a file named --cmd).
  • Loops for --data (line 236), --plugin (line 855), and --cmd (line 1068) silently skip the option when it is the last argument.
  • num() (lines 213-215) silently falls back to defaults (1600, 900, 96) when --width, --height, or --dpi is non-numeric or non-finite.

Proposed direction

Align these flags with mcp_register (line 682) and Strict::from_args (line 139): return a clear error (exit code 2) when a value-taking flag lacks a value, when a numeric flag cannot be parsed as a finite positive number, or when a subsequent flag is passed in place of a value. Because turning silent fallbacks into hard errors changes CLI behavior for callers with malformed invocations, this is tracked as a separate decision/change.

Activity

  1. added
    bug
    on Nov 25, 2026
  2. choupeanut commented on Nov 27, 2026

    @choupeanut
    Contributor

    I'd like to take this one: I'll refuse a value-taking flag with no value and a non-numeric or non-positive --width/--height/--dpi up front, with exit code 2. PR coming shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions