Skip to content

v3.2.0

Latest

Choose a tag to compare

@shibayan shibayan released this 21 Oct 09:50
· 1 commit to master since this release
Immutable release. Only release title and notes can be modified.
5e17ace

Highlights

Native AOT, verified on every change

  • CI now packs Sharprompt and publishes an app against the NuGet package with PublishAot. It runs on Linux, Windows, and macOS, for .NET 8 and .NET 10. Any trim or AOT warning fails the run. (#425)
  • Binders generated for [PromptBindable] models no longer raise trimming warnings, including for [MinLength], [MaxLength], and [Length]. (#423, #432)
  • New documentation covers Native AOT usage (#413), supported input types and custom [TypeConverter] types (#426), and how validation attributes behave under trimming (#432).

Cancellation

  • Every prompt and Prompt.Bind accepts a CancellationToken. (#404)
  • Custom console drivers can override the new IConsoleDriver.ReadKey(CancellationToken), which has a default implementation. (#419)

Source generator diagnostics

  • New warnings SHARP006–SHARP014 report invalid [PromptBindable] definitions at the attribute or property involved. Before, such definitions produced generated code that did not compile, threw at runtime, or silently ignored an attribute. See the diagnostics list. (#427)
  • Enums that the generated code cannot reference now use the reflection fallback instead of breaking the build. (#422)

Behavior changes

Check these when upgrading:

  • Unanswerable options throw before the prompt is shown:

    • a Select with no items throws ArgumentException
    • a MultiSelect whose Minimum exceeds the number of items throws ArgumentOutOfRangeException (#430)
  • Duplicate items: equal items in Select and MultiSelect are listed once. MultiSelect no longer returns the same value twice. (#430)

  • Display format: default value hints and answers in Input and List use the invariant format that input is parsed with. For example, 1.5 is shown instead of 1,5 under de-DE. (#426)

  • Control characters in prompt text are normalized:

    • line breaks render as separate lines
    • tabs expand to spaces
    • ANSI color (SGR) sequences are kept and end with their line
    • other escape sequences are removed
    • other control characters are shown as visible symbols

    (#431)

  • Enum items: order and aliases are now identical whether the metadata is generated or comes from the reflection fallback. (#420) Enums that use [Display(ResourceType = ...)] use the fallback, and their names follow the current UI culture. (#428)

  • New warnings: builds that treat warnings as errors may stop on the new SHARP warnings. Each one can be suppressed like any other warning. (#427)

Fixes

  • Runtime bugs in Select, MultiSelect, Input, and DefaultConsoleDriver. (#403, #417)
  • Redraws on Windows conhost when the prompt starts below the first screen of scrollback. (#424)
  • The Japanese invalid-minimum message threw FormatException. (#430)

What's Changed

  • Add CancellationToken support to prompts by @shibayan in #404
  • Fix MultiSelect bulk selection and Paginator previous item navigation by @shibayan in #403
  • Bump the dependencies group with 4 updates by @dependabot[bot] in #416
  • Bump the dependencies group with 3 updates by @dependabot[bot] in #415
  • Fix runtime bugs in Select, MultiSelect, Input and DefaultConsoleDriver by @shibayan in #417
  • Fix PromptBindable generator edge cases and add generator tests by @shibayan in #418
  • Move cancellation-aware key wait into IConsoleDriver by @shibayan in #419
  • Align EnumMetadataGenerator with the reflection fallback by @shibayan in #420
  • docs: document Native AOT guidance and fix [PromptBindable] code examples (#412) by @mkarimdev in #413
  • Build VitePress docs on pull requests by @shibayan in #421
  • Skip enums the generated metadata cannot reference by @shibayan in #422
  • Fix PromptBindableGenerator output that fails to compile, throws, or is not trim safe by @shibayan in #423
  • Clamp the render cursor row to the buffer, not the window by @shibayan in #424
  • Verify Native AOT publishing and execution against the NuGet package in CI by @shibayan in #425
  • Show prompt values in the format they parse and document type conversion under Native AOT by @shibayan in #426
  • Add source generator diagnostics for invalid [PromptBindable] definitions by @shibayan in #427
  • Bump the dependencies group with 2 updates by @dependabot[bot] in #429
  • Resolve resource display names the same way on both enum metadata paths by @shibayan in #428
  • Make Select and MultiSelect item and limit handling consistent by @shibayan in #430
  • Normalize control characters before measuring and writing prompt text by @shibayan in #431
  • Make length validators trim safe in generated binders and the example AOT ready by @shibayan in #432

New Contributors

Full Changelog: v3.1.3...v3.2.0