Add --pid-only flag to print just the matching PIDs#2
Conversation
Similar to lsof -t
mkomitee
left a comment
There was a problem hiding this comment.
I agree with copilots assessment that we should prefer a stable ordering where possible.
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new --pid-only flag to the procfd tool that outputs only the unique process IDs that match the query, similar to lsof's -t option. This provides a more concise output format when users only need the PIDs rather than full file descriptor information.
- Added
--pid-onlycommand-line flag with conflict handling against--json - Implemented PID-only output logic using HashSet for deduplication and sorted iteration
- Updated documentation to describe the new flag
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main.rs | Added HashSet import, --pid-only flag definition, and PID-only output implementation |
| README.md | Added documentation for the new --pid-only flag |
mkomitee
left a comment
There was a problem hiding this comment.
LGTM, but I don't understand why this is necessary. Couldn't folks use --json and parse with jq?
|
Yes, technically all filter options can be implemented with --json and jq, but cmdline flags are much easier. This is to bring partity with the |
Similar to lsof -t