Repository navigation
stop: bare in a terminal, a picker chooses what to stop - #31
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22
Why
Typing
ports stopand then hunting for the port number is the common case. In a terminal, bareports stopnow opens a picker over the listing: ↑/↓ (or k/j), Enter, thenyto confirm.What
cmd/picker.go): the table's own rows (inspect.TableRows). Rows only sudo can stop, and Windows-side rows seen from WSL, are dimmed and skipped. Esc, q or Ctrl-C leave with exit 130. The list scrolls to fit the terminal height and lines are cut to its width; a terminal under 7 lines is refused. Raw mode is restored on return and on SIGTERM/SIGQUIT/SIGHUP. Input that arrives with the Enter (a paste) is discarded, so it can't answer the confirm.stopPicked): after the confirm, ports rescans and stops only the chosen target (container ID, else pid plus start time, else systemd unit), never whatever holds the port now. If that target no longer holds the port, nothing is stopped, with a message to runports stopagain (exit 1). The confirm lists every port the target holds.--json, bareports stopis a usage error (exit 2).golang.org/x/term.Evidence
TestStopPickedStopsOnlyTheConfirmed: the scan is swapped between pick and stop for four cases (another process took the port, a reused pid, a moved port, and two pids sharing the port), and only the confirmed pid is ever stopped.TestStopPickerdrives a real PTY throughscript:--dry-runconfirm says "would stop";stopoff a TTY exits 2.go test ./internal/... ./cmd/...and./test/...pass;npm run lintandnpm run buildpass in web/.y, and resizing the terminal while the picker is open isn't handled.Rollback
Revert the squash commit. The picker is reached only through bare
ports stop, which was a usage error before this change.Generated by Claude Code