Skip to content

Extend built-in parseable argument types (Unity: Bounds, BoundsInt, RectOffset, Plane, Ray; System: Complex) #58

Description

@wallstop

DISCLOSURE: LLM-GENERATED TEXT

Follow-up from PR #57 review (CommandArg.cs:310): are there other built-in types worth
supporting natively in CommandArg.TryGet<T>, given the console's delimiter and quoting
model?

Current built-in coverage

  • Primitives: bool, char, byte/sbyte, short/ushort, int/uint, long/ulong,
    float/double/decimal, BigInteger, string.
  • System: Guid, Version, DateTime, DateTimeOffset, TimeSpan, IPAddress.
  • Enums (name or numeric index) plus named-constant lookup for static
    properties/const fields (red, MaxValue).
  • Unity math types: Vector2/3/4, Vector2Int/3Int, Color, Quaternion, Rect, RectInt.

Candidates that parse naturally from delimited text

  • Unity: Bounds (center/size), BoundsInt (position/size), RectOffset
    (left/top/right/bottom), Plane (normal + distance), Ray (origin + direction).
  • System.Numerics: Complex (re, im) — BigInteger is already supported, so this is
    consistent.
  • Possibly Matrix4x4 and Vector4-based color formats — heavier, decide separately.

Caveats to settle before implementing

  1. Text format per type must be documented in the command help surface and survive the
    shell's delimiter set (,, ;, :, _, /, \) — e.g. Bounds uses : inside
    Unity's own ToString(), which collides with the delimiter set; choose an
    unambiguous format or accept Unity-ToString-style input like the Rect parser does
    (x:/width: stripping).
  2. Each addition rides the culture-invariant path from Warnings as errors + built-in analyzers (#55), user-facing changelog (#54) #57 (CommandArgParsers, pinned
    NumberStyles + InvariantCulture).
  3. Cheap types first; anything needing allocation-heavy parsing (AnimationCurve,
    Gradient) is likely out of scope for a console argument.
  4. Data-driven PlayMode coverage per type in CommandArgTests, matching the house
    style, plus ParsingIsCultureInvariant cases where relevant.

Related: the TryGet dispatch refactor issue (table-driven registry) should land first or
together, so each new type is one table entry, not another else if arm.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions