Skip to content

Migrate from optparse-applicative-fork to optparse-applicative 0.19#1390

Draft
Jimbo4350 wants to merge 1 commit into
masterfrom
jordan/migrate-to-optparse-applicative
Draft

Migrate from optparse-applicative-fork to optparse-applicative 0.19#1390
Jimbo4350 wants to merge 1 commit into
masterfrom
jordan/migrate-to-optparse-applicative

Conversation

@Jimbo4350

@Jimbo4350 Jimbo4350 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace optparse-applicative-fork 0.18.1.0 with upstream optparse-applicative 0.19.0.0.

Upstream has incorporated the two features that motivated the fork:

  • PR #428 — prettyprinter switch (upstream 0.18.0.0)
  • PR #425 — smart brief description formatting (upstream 0.19.0.0 as briefHangPoint)

Capability regressions

Two fork-specific hooks have no upstream equivalent:

  • prefRenderHelp (helpRenderHelp in prefs) — the fork allowed injecting a custom renderer into all --help output. Upstream has no such hook. customRenderHelp now only covers the explicit cardano-cli help command path; --help on subcommands goes straight through optparse's built-in renderHelp.

  • helpEmbedBriefDesc PP.align — the fork took a Doc -> Doc function for full control over usage line overflow. Upstream only has briefHangPoint :: Int -> PrefsMod, replaced here with briefHangPoint 35. The formatting output will differ.

Other changes

  • Render.hs: remove fork-specific Ann/AnnTrace HTML tracing; simplify to customRenderHelp = renderHelp. The CLI_HELP_TRACE feature was never wired up (no annTrace call sites) so nothing functional is lost.
  • Transaction/Option.hs: H.yellow/H.underline replaced with local helpers via H.annotate — upstream re-exports Prettyprinter.Render.Terminal so the capability is there, just not pre-wrapped.

Golden tests

The 492 help text golden files will need updating due to formatting differences from briefHangPoint 35 vs helpEmbedBriefDesc PP.align.

Changelog

- description: |
    Migrate from optparse-applicative-fork to upstream optparse-applicative 0.19.0.0
  type:
    - maintenance

Context

Upstream has caught up with the two IOG PRs that motivated the fork. The fork's additional hooks (prefRenderHelp, helpEmbedBriefDesc) are lost but may be worth raising with upstream if the formatting differences are unacceptable.

How to trust this PR

  • Compiles cleanly against optparse-applicative 0.19.0.0
  • Only removes dead code and rewires existing functionality to upstream equivalents

Checklist

  • Compiles
  • Golden tests updated (follow-up)

Upstream now includes the prettyprinter switch (PR #428) and briefHangPoint
formatter (PR #425), making the fork unnecessary.

Two capabilities from the fork are not available in upstream:
- prefRenderHelp: no hook to inject a custom renderer into the --help path
- helpEmbedBriefDesc: replaced with the coarser briefHangPoint 35

The CLI_HELP_TRACE tracing (Ann/AnnTrace) is removed; it was never wired up.
Golden tests will need updating due to formatting changes.
@Jimbo4350 Jimbo4350 force-pushed the jordan/migrate-to-optparse-applicative branch from c44b06e to 0d0820d Compare June 16, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant