-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -f option for CSV output to allow field filtering #1372
Open
soonghee2
wants to merge
9
commits into
projectdiscovery:dev
Choose a base branch
from
soonghee2:csv_field_option
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
Thanks for your contribution @soonghee2 ! :) |
This commit refactors the CSV header and field handling logic to remove code duplication and improve readability. It consolidates the header and field selection functionality using the `selectedFields` parameter and eliminates the unnecessary global variable.
This commit addresses two issues: - Fixed an import error that was preventing the code from compiling correctly. The specific import that was missing or incorrect has been corrected. - Removed the unnecessary `selectedFields` variable declaration. This variable was declared but not used, so it has been removed to clean up the code.
This commit addresses two issues: - **Invalid Option Handling:** Modified the code to invalidate the option when "-f "" " is provided as input. This prevents unexpected behavior or errors when an empty string is passed with the -f flag. - **GitHub Lint Test Fixes:** Implemented necessary changes to ensure the code passes the GitHub lint tests. These modifications address any style, formatting, or potential code quality issues identified by the linter.
Code updated!
|
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.
Description
This PR enhances the existing -csv output functionality by adding support for a -f (or --fields) option. Users can now specify which columns they want in the CSV output instead of always receiving all available fields.
Related Issue
Closeshttps://github.com//issues/1371
Changes Introduced
Added -f option to allow field filtering when using -csv.
Updated CSV output logic to include only specified fields.
Example Usage
Outputs only the ip and port columns instead of the full dataset.
In a future update, we can extend this functionality so that -json -f "ip,port" also filters the JSON response accordingly.
Looking forward to feedback!