Skip to content

Add --pid-only flag to print just the matching PIDs#2

Merged
propertone merged 5 commits intomainfrom
pid_only
Jul 30, 2025
Merged

Add --pid-only flag to print just the matching PIDs#2
propertone merged 5 commits intomainfrom
pid_only

Conversation

@propertone
Copy link
Copy Markdown
Member

Similar to lsof -t

@propertone propertone requested a review from mkomitee July 5, 2025 21:33
@propertone propertone self-assigned this Jul 5, 2025
@propertone propertone requested a review from Copilot July 5, 2025 21:34

This comment was marked as outdated.

Copy link
Copy Markdown

@mkomitee mkomitee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with copilots assessment that we should prefer a stable ordering where possible.

@propertone propertone requested review from Copilot and mkomitee July 8, 2025 00:42

This comment was marked as outdated.

@propertone propertone requested a review from Copilot July 19, 2025 16:24

This comment was marked as outdated.

@propertone propertone requested a review from Copilot July 19, 2025 16:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-only command-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

Copy link
Copy Markdown

@mkomitee mkomitee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I don't understand why this is necessary. Couldn't folks use --json and parse with jq?

@propertone
Copy link
Copy Markdown
Member Author

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 lsof -t flag, which is handy for piping to xargs kill.

@propertone propertone merged commit 8c55374 into main Jul 30, 2025
@propertone propertone deleted the pid_only branch July 30, 2025 19:13
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.

3 participants