Skip to content

Conversation

@njg7194
Copy link

@njg7194 njg7194 commented Feb 1, 2026

Fixes #4976

Summary

When a default value is an empty string, the help output now displays [default: ""] instead of [default: ], making it clear that the default is an empty string rather than appearing to be missing.

Changes

  • help_template.rs: Added check for empty strings in default value display
  • possible_value.rs: Added check for empty strings in get_visible_quoted_name
  • format.rs: Added check for empty strings in Escape Display impl

Before

Options:
      --text <TEXT>  [default: ]
  -h, --help         Print help

After

Options:
      --text <TEXT>  [default: ""]
  -h, --help         Print help

This is a minimal change that follows the existing pattern of using Rust debug representation for values that need quoting.

Fixes clap-rs#4976

When a default value is an empty string, the help output now displays
`[default: ""]` instead of `[default: ]`, making it clear that
the default is an empty string rather than appearing to be missing.

Changes:
- help_template.rs: Added check for empty strings in default value display
- possible_value.rs: Added check for empty strings in get_visible_quoted_name
- format.rs: Added check for empty strings in Escape Display impl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default display for String is awkward, ie [default: ]

1 participant