diff --git a/src/gallia/commands/scan/uds/identifiers.py b/src/gallia/commands/scan/uds/identifiers.py index 976cab06f..69fbb8e4b 100644 --- a/src/gallia/commands/scan/uds/identifiers.py +++ b/src/gallia/commands/scan/uds/identifiers.py @@ -6,7 +6,7 @@ from itertools import product from gallia.command import UDSScanner -from gallia.command.config import AutoInt, Field, HexBytes, Ranges, Ranges2D +from gallia.command.config import AutoInt, EnumArg, Field, HexBytes, Ranges, Ranges2D from gallia.command.uds import UDSScannerConfig from gallia.log import get_logger from gallia.services.uds.core.client import UDSRequestConfig @@ -28,7 +28,7 @@ class ScanIdentifiersConfig(UDSScannerConfig): payload: HexBytes | None = Field( None, description="Payload which will be appended for each request as hex string" ) - service: UDSIsoServices = Field( + service: EnumArg[UDSIsoServices] = Field( UDSIsoServices.ReadDataByIdentifier, description="\n Service (ID) to scan; defaults to ReadDataByIdentifier;\n currently supported:\n 0x27 Security Access;\n 0x22 Read Data By Identifier;\n 0x2e Write Data By Identifier;\n 0x31 Routine Control;\n ", ) diff --git a/vendor/pydantic-argparse/pydantic_argparse/parsers/enum.py b/vendor/pydantic-argparse/pydantic_argparse/parsers/enum.py index 47b2d8952..8bff51026 100644 --- a/vendor/pydantic-argparse/pydantic_argparse/parsers/enum.py +++ b/vendor/pydantic-argparse/pydantic_argparse/parsers/enum.py @@ -50,7 +50,7 @@ def parse_field( enum_type = cast(Type[enum.Enum], field.info.annotation) # Determine Argument Properties - metavar = f"{{{', '.join(f'{e.value}({e.name})' for e in enum_type)}}}" + metavar = f"{{{', '.join(f'{e.value}' for e in enum_type)}}}" action = argparse._StoreAction # Add Enum Field diff --git a/vendor/pydantic-argparse/pydantic_argparse/parsers/literal.py b/vendor/pydantic-argparse/pydantic_argparse/parsers/literal.py index e0a906782..4d9946434 100644 --- a/vendor/pydantic-argparse/pydantic_argparse/parsers/literal.py +++ b/vendor/pydantic-argparse/pydantic_argparse/parsers/literal.py @@ -55,16 +55,7 @@ def parse_field( # Extract Choices choices = get_args(field.info.annotation) - # Determine Argument Properties - choice_reprs = [] - - for c in choices: - if isinstance(c, Enum): - choice_reprs.append(f"{c.name}({c.value})") - else: - choice_reprs.append(str(c)) - - metavar = f"{{{', '.join(choice_reprs)}}}" + metavar = f"{{{', '.join(str(c) for c in choices)}}}" action = argparse._StoreAction