Skip to content

fix(tui): honor CLI targets when launching interactive mode - #238

Merged
pranshuparmar merged 1 commit into
pranshuparmar:mainfrom
chiliec:fix/interactive-respects-targets
Oct 3, 2026
Merged

pranshuparmar merged 1 commit into
pranshuparmar:mainfrom
chiliec:fix/interactive-respects-targets

Conversation

@chiliec

@chiliec chiliec commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #237.

witr -i ignored every other flag: witr -p <pid> -i opened the TUI with nothing selected, and -o / -c / -f / a process name had no effect on how interactive mode started.

Interactive mode now receives the same ordered target list the non-interactive path builds and seeds the initial state from it:

  • -p <pid> — the row for that PID is selected (and its ancestry tree fetched) as soon as the first process list arrives.
  • <name> — pre-fills the Processes filter.
  • -o <port> — opens the Ports tab with the filter set.
  • -c <container> — opens the Containers tab with the filter set.
  • -f <file> — opens the Locks tab with the filter set (where the tab is available).

When a non-Processes tab is opened, Init also kicks off that tab's refresh so the seeded filter has data to apply to. With no targets the behaviour is unchanged.

Testing

  • go build ./..., go vet ./internal/tui ./internal/app, gofmt -l internal/ clean.
  • New TestWithTargetsSeedsInitialState in internal/tui/update_test.go covers pid selection on the first []model.Process message (cursor lands on the right row, tree fetch command returned, seed cleared), name filter narrowing, port tab + filter narrowing the port table, container tab + filter, and the no-target default.
  • go test ./... — all packages pass.
  • Manual smoke on Linux: witr -i nginx opens with > nginx in the filter box; witr -i -p 1 opens with PID 1 highlighted and its ancestry in the side panel.

@pranshuparmar
pranshuparmar merged commit 251206d into pranshuparmar:main Oct 3, 2026
16 of 17 checks passed
@pranshuparmar pranshuparmar added this to the 0.3.4 milestone Oct 3, 2026
@pranshuparmar

Copy link
Copy Markdown
Owner

@chiliec Thanks for the contribution, available with https://github.com/pranshuparmar/witr/releases#release-v0.3.4

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.

Interactive mode should respect other filters/flags

2 participants