-
Notifications
You must be signed in to change notification settings - Fork 53
json output install #392
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
json output install #392
Conversation
66d38b0
to
0a3c929
Compare
0a3c929
to
6d83aef
Compare
if let progressFile | ||
{ | ||
try JsonFileProgressReporter(ctx, filePath: progressFile) | ||
} else if ctx.format == .json { |
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.
question: Since we've been generally putting messages on stderr when json formatted output is requested, could the ConsoleProgressReporter do the same thing?
9e1063a
to
176e123
Compare
@@ -312,16 +318,18 @@ struct Install: SwiftlyCommand { | |||
} | |||
} | |||
|
|||
let animation: ProgressReporterProtocol = | |||
let animation: ProgressReporterProtocol? = |
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.
suggestion: Now that the animation will always get a non-nil value in each case, this variable can become non-optional type. That should make the code below a bit simpler since it doesn't have to handle the optionality in every case.
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.
I have a condition that requires animation to be optional for the JSON format.
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.
Ah, I see now. Can the ctx.format == .json
case create a ConsoleProgressReporter with stderr as the stream, and then the else case uses stdout as the stream?
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.
yes, that is doable.
} else { | ||
ConsoleProgressReporter(stream: stdoutStream, header: "Downloading \(version)") | ||
ConsoleProgressReporter(stream: stderrStream, header: "Downloading \(version)") |
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.
issue (blocking): The default case should continue to report progress to stdout. The json output case would be the one to output to stderr, so that the progress wouldn't corrupt the json.
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.
Ohh, yes I missed this while earlier review.
354bdd9
to
5d0f49f
Compare
Fixes Issue #376