-
Notifications
You must be signed in to change notification settings - Fork 15
Add optional JSON output #52
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 optional JSON output #52
Conversation
- Allow users to select a custom reporter that prints JSON instead of `sed` commands - Opt-in by adding "reporter": "json" to the configuration file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! can you ensure newlines at the end of the files
Sources/unused-imports/main.swift
Outdated
if string == "json" { | ||
self.reporter = JSONReporter() | ||
} else { | ||
self.reporter = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this case error for unhandled values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. Great suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Sources/unused-imports/main.swift
Outdated
self.reporter = nil | ||
} | ||
} else { | ||
self.reporter = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.reporter = nil | |
self.reporter = SedCommandReporter() |
seems fine to default this here so you can eliminate the optionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. 100%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
thanks! |
Allow users to select a custom reporter that prints JSON instead of
sed
commandsOpt-in by adding
"reporter": "json"
to the configuration file