Skip to content

tui: wire up reverse-forward adding via the a prompt - #12

Merged
lacraig2 merged 2 commits into
mainfrom
tui-reverse-add
Jun 19, 2026
Merged

tui: wire up reverse-forward adding via the a prompt#12
lacraig2 merged 2 commits into
mainfrom
tui-reverse-add

Conversation

@lacraig2

Copy link
Copy Markdown
Collaborator

What

Fixes a build break in src/tui.rs and finishes the in-progress feature it was part of.

The reverse_set field on App had been added but never initialized, so the build failed with E0063 (./scripts/pm.sh build). Rather than just silence the resulting unused-field warning (which would fail CI's clippy -D warnings), this wires the field up to the feature it was intended for.

Changes

  • Fix the break: App::new now takes reverse_set: Arc<ReverseSet>; run() and all test call sites updated.
  • Wire up the feature: the a add prompt now routes a spec prefixed with -R / --reverse to ReverseSet::add(...) as a reverse forward; without the prefix it stays a normal forward. The prefix is the disambiguator because both forward and reverse grammars use -> — mirroring the CLI's -R/--reverse flag.
  • Add reverse_flag_rest helper (matches the flag only as a whole token, so -R3000->3000 isn't misread) with a unit test.
  • Document the prefix in the add-prompt footer and the help overlay.

Usage

In the TUI: press a, then e.g. -R 3000->3000 to bind a reverse forward on the remote.

Testing

  • ./scripts/pm.sh build — passes
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo test --lib — 87 passed

Note

I chose the -R prefix convention for the prompt since the field's comment only said "the a prompt can add reverse forwards" without specifying UX. If a dedicated reverse-add keybinding was intended instead, happy to switch.

Luke Craig added 2 commits June 19, 2026 15:56
The reverse_set field added to App was never initialized, breaking the
build (E0063). Thread it through App::new, and use it: the `a` add prompt
now routes a spec prefixed with `-R`/`--reverse` to ReverseSet::add as a
reverse forward (mirroring the CLI flag). Both forward and reverse
grammars use `->`, so the flag is the only disambiguator.

Add reverse_flag_rest (matches the flag only as a whole token) with a
unit test, and document the prefix in the add prompt and help overlay.
- 'a' then '-R <spec>' (or --reverse) adds a reverse forward
- reverse rows are now selectable; the table selection spans forwards
  (→ <port>) then reverse (← <port>), with a unified Selection enum
- 'd' drops and 'i' inspects whichever row is selected; o/y/v hint that
  they apply to forwards only on a reverse row
- reverse detail card (no sparkline; reverse rates aren't sampled)
- footer/help/README updated

Test: reverse row renders, is selectable, and drops via the table.
@lacraig2
lacraig2 merged commit 12e39c4 into main Jun 19, 2026
8 checks passed
@lacraig2
lacraig2 deleted the tui-reverse-add branch June 19, 2026 20:57
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