Michael Eischer
3410808dcf
deduplicate termstatus setup
2025-10-03 18:55:46 +02:00
Michael Eischer
1ae2d08d1b
termstatus: centralize OutputIsTerminal checks
2025-10-03 18:55:46 +02:00
Michael Eischer
c745e4221e
termstatus: use errWriter instead of os.Stderr
2025-10-03 18:22:42 +02:00
Michael Eischer
08443fe593
Merge pull request #5405 from restic/dependabot/github_actions/golangci/golangci-lint-action-8
...
build(deps): bump golangci/golangci-lint-action from 6 to 8
2025-09-21 22:37:26 +02:00
Michael Eischer
daeb55a4fb
Merge pull request #5511 from greatroar/atomic
...
ui/progress: Restore atomics in Counter
2025-09-21 22:29:40 +02:00
Michael Eischer
60d80a6127
Fix linter warnings
2025-09-21 22:24:15 +02:00
Michael Eischer
65b21e3348
ui: collect Quote and Truncate helpers
...
Collect ui formatting helpers in the ui package
2025-09-21 16:44:23 +02:00
Michael Eischer
86ddee8518
ui: document Message / Printer / Terminal interfaces
2025-09-21 16:32:00 +02:00
greatroar
a8f506ea4d
ui/progress: Simplify Updater
...
Removed a defer'd call that was a bit subtle.
2025-09-16 09:56:33 +02:00
greatroar
0a1ce4f207
ui/progress: Restore atomics in Counter
...
We switched from atomics to a mutex in #3189 because of an alignment
bug, but the new-style atomic types don't need manual alignment.
2025-09-16 09:49:48 +02:00
Michael Eischer
94b19d64be
termstatus: allow retrieving the underlying writer
...
This is intended for special cases where it must be guaranteed that the
output on stdout exactly matches what was written to the io.Writer.
2025-09-15 22:17:26 +02:00
Michael Eischer
03600ca509
termstatus: don't buffer stdout
...
There's not much use in doing so as nearly every write call was paired
with a flush call. Thus, just use an unbuffered writer.
2025-09-15 21:22:07 +02:00
Michael Eischer
91ecac8003
termstatus: fix crash when printing empty string
2025-09-15 20:25:17 +02:00
Michael Eischer
32b7168a9e
centralize index progress bar for termstatus
2025-09-15 20:25:17 +02:00
Michael Eischer
43b5166de8
terminal: cleanup determining width
2025-09-08 11:03:42 +02:00
Michael Eischer
93ccc548c8
termstatus: move cursor handling to terminal package
2025-09-08 11:03:17 +02:00
Michael Eischer
0ab38faa2e
termstatus: track current status also in background
...
Without this, restic could temporarily print an outdated status when
moving back into the foreground.
2025-09-08 10:50:53 +02:00
Michael Eischer
48cbbf9651
ui/termstatus: extract background handling code
2025-09-08 10:50:09 +02:00
greatroar
1ed93bd54d
backend,termstatus: Unify foreground/background detection
...
PR #5358 reintroduced a version of the TIOCGPGRP ioctl call that works
on all Unix platforms except Linux, due to a bug/inconsistency in
x/sys/unix. This commit fixes that by introducing termstatus.Tcgetpgrp.
It also introduces termstatus.Getpgrp and termstatus.Tcsetpgrp to deal
with the different signature of unix.Getpgrp in Solaris vs. all other
Unix platforms and an int-overflowing constant on AIX, so that some
AIX/Solaris-specific code can be removed elsewhere and
foreground/background detection is done the same everywhere except on
Windows.
2025-09-08 09:33:44 +02:00
Michael Eischer
66a8e897a9
Merge pull request #5300 from MichaelEischer/fix-output-race
...
ui/termstatus: fix race condition in StdioWrapper
2025-03-24 11:17:14 +01:00
Michael Eischer
ec19d67512
ui/termstatus: fix race condition in StdioWrapper
2025-03-24 11:07:15 +01:00
Michael Eischer
f7f48b3026
ui/progress: extend Printer interface with print to stdout method
2025-03-23 17:46:04 +01:00
Martin Smith
f238f81ba6
Renames to fix clashes with reserved words.
2025-03-22 18:20:30 +00:00
Martin Smith
3788605127
Rename unused parameters to '_'.
2025-03-22 18:20:30 +00:00
Martin Smith
092899df8b
Remove unnecessary type conversions.
2025-03-22 18:20:30 +00:00
Martin Smith
1daf5317f8
Fix import ordering.
2025-03-22 18:20:30 +00:00
greatroar
c1781e0abb
ui/termstatus: Remove unused bytes.Buffer
2025-02-01 08:21:40 +01:00
Srigovind Nayak
d7d9af4c9f
ui: restore --delete indicates number of deleted files ( #5100 )
...
* ui: restore --delete indicates number of deleted files
* adds new field `FilesDeleted` to the State struct, JSON and text progress updaters
* increment FilesDeleted count when ReportedDeletedFile
* ui: collect the files to be deleted, delete, then update the count post deletion
* docs: update scripting output fields for restore command
ui: report deleted directories and refactor function name to ReportDeletion
2024-12-01 15:29:11 +01:00
Michael Eischer
9c758313e3
Merge pull request #5119 from MichaelEischer/backup-json-start-end-time
...
backup: include start and end time in json output
2024-11-11 21:50:30 +01:00
Michael Eischer
569a117a1d
improve fprintf related error handling
2024-11-01 17:07:43 +01:00
Michael Eischer
e65f4e2231
backup: include start and end time in json output
...
The timestamps were already stored in the created snapshot.
2024-11-01 16:31:34 +01:00
Michael Eischer
ca1e5e10b6
add proper constants for node type
2024-08-31 18:20:01 +02:00
Michael Terry
88f59fc2d6
json: switch backup and restore errors from string to struct types
...
This keeps backwards compatibility with the previous empty structs.
And maybe we'd want to put other fields into the inner struct later,
rather than the outer message.
2024-08-03 16:21:44 -04:00
Michael Terry
a376323331
restore: print JSON versions of errors in --json mode
...
Previously, they were printed as freeform text.
This also adds a ui.Terminal interface to make writing
tests easier and also adds a few tests.
2024-08-03 15:18:46 -04:00
Michael Terry
ad2585af67
backup: show actual error strings in --json mode
...
Previously, an error JSON fragment would look like:
{"message_type": "error", "error": {}}
This is because encoding/json cannot marshal an error interface.
Instead, we now call .Error() to get the string value.
2024-08-03 15:07:52 -04:00
Michael Terry
f4bdfea1c9
backup: print scanner errors to stderr, not stdout
2024-08-03 15:07:52 -04:00
Michael Eischer
59c880fce3
restorer: only show size in text output for files
2024-07-20 12:46:28 +02:00
Michael Eischer
aedead2823
ui/termstatus: fix clearing status lines
...
To clear the status lines, they should be set to an empty array to
prevent future updates of those lines. Setting the status lines to an
array containing an empty string is wrong as this causes the output to
continuously add that empty status line after each message.
2024-07-06 11:27:35 +02:00
Michael Eischer
aa8e18cf32
restore: add deletions to progress output
2024-07-05 22:38:39 +02:00
Michael Eischer
ae978d60cc
restore: pass action enum to restore progress
2024-07-05 20:41:27 +02:00
Michael Eischer
c47bf33884
restore: print processed files at maximum verbosity
2024-07-05 20:41:27 +02:00
Michael Eischer
e47e08a688
restorer: separately track skipped files
2024-06-12 22:36:52 +02:00
Michael Eischer
64b7b6b975
restore/ui: refactor for extensibility
2024-06-12 22:36:52 +02:00
Michael Eischer
607daeed4f
restore: move nil pointer check into restoreui
2024-06-12 22:36:52 +02:00
Michael Eischer
7cd324fe26
ui/table: avoid duplicate table cell width calculation
2024-06-07 21:45:40 +02:00
Michael Eischer
edd3e214c2
ui/table: fix width calculation of multi-line column headers
2024-06-07 21:44:49 +02:00
Florian Thoma
e9de9684f4
Use character display width for table padding
...
Using len(...) for table cell padding produced wrong results for unicode
chracters leading to misaligned tables. Implementation changed to take
the actual terminal display width into consideration.
2024-06-05 09:33:15 +02:00
Michael Eischer
6869bdaaa8
backup: implement --skip-if-unchanged
2024-05-30 15:14:31 +02:00
greatroar
46f04bc5f0
termstatus: Do formatting in Message, not Terminal
2024-05-27 19:05:39 +02:00
greatroar
66d03c797e
ui, termstatus: Move WrapStdio
...
Saves some imports. ui still needs to import ui/termstatus from
message.go.
2024-05-21 11:25:16 +02:00