GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Empty string default values are not displayed · Issue #2500 · pallets/click

Empty string default values are not displayed #2500

New issue
Copy link
New issue
Copy link
Closed
#2724
Closed
Empty string default values are not displayed#2500
#2724
Copy link
Labels
help outputHelp text formatting, layout, and --help rendering
Milestone
8.1.8

Description

@m-freiberg
m-freiberg
opened on Apr 28, 2023
Issue body actions

If an option has a default value of "", the show_default option does not display anything.

Reproducible example:

import click

@click.group()
def test_cli() -> None:
    pass 


@test_cli.command(help="Test CLI")
@click.option("--test_value", type=str, default="", show_default=True)
def test_function(
    test_value: str
) -> None:
    print(test_value)


@click.group()
def cli() -> None:
    pass


cli.add_command(test_cli)
cli()

Expected to see a default displayed. Actual behavior:
image

Environment:

  • Python version: 3.11.3
  • Click version: 8.0.3
Reacted by Johan Gustafsson

Activity

  1. davidism
    added this to the 8.2.0 milestone on Jul 4, 2023
  2. karljohang commented on Aug 10, 2023

    @karljohang
    karljohang
    on Aug 10, 2023
    More actions

    I solved this by using the trick found under Dynamic Defaults for Prompts but I don't think the documentation mentions elsewhere that show_default can be a non-boolean value. Regardless, it still doesn't show for prompts, where the only visual signifier is the empty pair of brackets.

  3. stefmolin commented on May 20, 2024

    @stefmolin
    stefmolin
    on May 20, 2024
    Contributor
    More actions

    I'm working on this at the PyCon US 2024 sprints.

  4. davidism
    modified the milestones: 8.2.0, 8.1.8 on May 21, 2024
  5. davidism
    closed this as completedon May 21, 2024
  6. github-actions
    locked as resolved and limited conversation to collaborators on Jun 5, 2024
  7. kdeldycke
    added
    help outputHelp text formatting, layout, and --help rendering
    on Aug 8, 2026
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

    help outputHelp text formatting, layout, and --help rendering

    Type

    No type

    Projects

    No projects

      Milestone

      • 8.1.8

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.