Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upbackup: Support --json flag by streaming JSON to report progress #1944
Conversation
mholt
changed the title
backup: Support --json flag by streaming JSON to report progress
backup: Support --json flag by streaming JSON to report progress (WIP)
Aug 11, 2018
This comment has been minimized.
This comment has been minimized.
codecov-io
commented
Aug 11, 2018
•
Codecov Report
@@ Coverage Diff @@
## master #1944 +/- ##
==========================================
- Coverage 50.76% 46.54% -4.23%
==========================================
Files 176 176
Lines 14188 14216 +28
==========================================
- Hits 7203 6617 -586
- Misses 5933 6603 +670
+ Partials 1052 996 -56
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
Alrighty -- I've finished implementing Again, I don't feel this is the cleanest solution but I don't know a better way right now. Happy to have your thoughts or modifications if you have any ideas. :) For the purposes of a convenient review, I've left in (comments) the original, human-formatted outputs so that you can compare what was being printed to the terminal and what is being populated in the JSON fields. They should be the same, sans fancy formatting. I can remove those comments before a final merge. Although functional, the code is not really in its final state, so I expect to iterate a bit. Let me know what you think! |
mholt
reviewed
Aug 19, 2018
@@ -355,7 +355,7 @@ func OpenRepository(opts GlobalOptions) (*repository.Repository, error) { | |||
return nil, err | |||
} | |||
|
|||
if stdoutIsTerminal() { | |||
if stdoutIsTerminal() && !opts.JSON { |
This comment has been minimized.
This comment has been minimized.
mholt
Aug 19, 2018
Author
Contributor
Just realized I made a similar, but slightly different variant of this change over at #1962: https://github.com/restic/restic/pull/1962/files#diff-952c97fd56de92e641e61b3b3aa881dbR363
This comment has been minimized.
This comment has been minimized.
Resolved the merge conflict. Would anyone else like to try this out? I think it's pretty cool. I just don't love the code that does it. It'd be great to get another set of eyes on the code to get ready to merge this. |
mholt
referenced this pull request
Oct 5, 2018
Open
Progress UI for the new optimized restore implementation #2003
fd0
referenced this pull request
Nov 22, 2018
Open
Add --json option to "restic backup" (feature) #2096
This comment has been minimized.
This comment has been minimized.
Mebus
commented
Nov 23, 2018
Hi Matt, I just tested it. This looks great! Can you please also include the ID of the created snapshot in the summary? This would be useful for a GUI.
Thanks Mebus |
This comment has been minimized.
This comment has been minimized.
Sure thing @Mebus! Thanks for testing it. I'll revisit this PR shortly. |
fd0
force-pushed the
mholt:jsonprogress
branch
3 times, most recently
from
2a89a3a
to
c1e337c
Dec 1, 2018
mholt
changed the title
backup: Support --json flag by streaming JSON to report progress (WIP)
backup: Support --json flag by streaming JSON to report progress
Dec 3, 2018
mholt
requested a review
from
fd0
Jan 7, 2019
This comment has been minimized.
This comment has been minimized.
This PR is ready for approval and merge |
This comment has been minimized.
This comment has been minimized.
@fd0 I know you're busy, but can you just click the Merge button? |
mholt
added some commits
Aug 11, 2018
fd0
force-pushed the
mholt:jsonprogress
branch
from
cbaecf3
to
6cf1348
Feb 10, 2019
This comment has been minimized.
This comment has been minimized.
I've rebased and resolved the merge conflict (and removed the merge of the master branch), and I'll merge this as soon as the CI tests complete :) |
mholt commentedAug 11, 2018
•
edited
What is the purpose of this change? What does it change?
restic backup
now supports--json
so that it can stream JSON output to update the progress of the backup, making it better for non-interactive, but supervised, use.Currently, the basic updates are sent as JSON and seem to be working, but I am still transitioning the copy of ui.Backup to the new jsonstatus.Backup type. I will iterate on this.
Was the change discussed in an issue or in the forum before?
Closes #1937
Checklist
changelog/unreleased/
that describes the changes for our users (template here)gofmt
on the code in all commits