Wrong default value is displayed for a string Enum option #703
Answered
by
svlandeg
avoskresensky
asked this question in
Questions
-
First Check
Commit to Help
Example Codefrom typing import Optional, Annotated
import logging
import typer as t
from enum import Enum
root = t.Typer()
class LogLevel(str, Enum):
"""LogLevel enumeration.
"""
DEBUG = 'DEBUG'
INFO = 'INFO'
WARNING = 'WARNING'
ERROR = 'ERROR'
CRITICAL = 'CRITICAL'
@root.command()
def _root(log_level: Annotated[Optional[LogLevel], t.Option(case_sensitive=False)] = LogLevel.WARNING):
if log_level:
logger = logging.getLogger()
logger.setLevel(log_level.value) DescriptionHere's what I get in --help for the above code:
The displayed default value uses the Python enum notation. Operating SystemWindows Operating System DetailsNo response Typer Version0.9.0 Python Version3.11.6 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
svlandeg
Mar 14, 2024
Replies: 1 comment
-
Hi! Thanks for the report. This behaviour should be fixed by PR #473 😎 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
svlandeg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Thanks for the report. This behaviour should be fixed by PR #473 😎