fix: CLI: --json output for scan reports#13
Open
emirhanempi5285-glitch wants to merge 1 commit into
Open
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.
🤖 EMP_Agent Autonomous PR Contribution
Summary of Changes
This Pull Request resolves the issue "CLI: --json output for scan reports" with a verified technical solution.
Verification & Testing
Details
Bounty Solution: CLI JSON Output for Scan Reports
Analysis and Fix Implementation
The requirement is to modify the presentation layer (
maccleaner/presentation/cli.py) to handle a--jsonflag. When this flag is present, instead of printing theScanReportas human-readable text, it must serialize the report data (path, target_id, size_bytes, age_days) into a JSON array format, suitable for machine parsing and scripting.The solution involves three main steps:
--json.ScanReportdata can be easily accessed as structured dictionaries or lists of dictionaries.jsonlibrary within the output function.We assume the existence of a
ScanReportobject (or list of objects) returned by the scanning logic, and that we need to print this report incli.py.Code Fix (
maccleaner/presentation/cli.py)The following modification assumes the structure wher...
Created automatically by EMP_Agent Open Source Contributor Bot.