mirror of
https://github.com/restic/restic.git
synced 2025-12-11 18:47:50 +00:00
termstatus: additional comments
This commit is contained in:
@@ -17,14 +17,20 @@ type Terminal interface {
|
|||||||
// CanUpdateStatus returns true if the terminal can update the status lines.
|
// CanUpdateStatus returns true if the terminal can update the status lines.
|
||||||
CanUpdateStatus() bool
|
CanUpdateStatus() bool
|
||||||
|
|
||||||
|
// InputRaw returns the input reader.
|
||||||
InputRaw() io.ReadCloser
|
InputRaw() io.ReadCloser
|
||||||
|
// InputIsTerminal returns true if the input is a terminal.
|
||||||
InputIsTerminal() bool
|
InputIsTerminal() bool
|
||||||
|
// ReadPassword reads the password from the terminal.
|
||||||
ReadPassword(ctx context.Context, prompt string) (string, error)
|
ReadPassword(ctx context.Context, prompt string) (string, error)
|
||||||
|
|
||||||
|
// OutputWriter returns a output writer that is safe for concurrent use with
|
||||||
|
// other output methods. Output is only shown after a line break.
|
||||||
OutputWriter() io.Writer
|
OutputWriter() io.Writer
|
||||||
// OutputRaw returns the output writer. Should only be used if there is no
|
// OutputRaw returns the raw output writer. Should only be used if there is no
|
||||||
// other option. Must not be used in combination with Print, Error, SetStatus
|
// other option. Must not be used in combination with Print, Error, SetStatus
|
||||||
// or any other method that writes to the terminal.
|
// or any other method that writes to the terminal.
|
||||||
OutputRaw() io.Writer
|
OutputRaw() io.Writer
|
||||||
|
// OutputIsTerminal returns true if the output is a terminal.
|
||||||
OutputIsTerminal() bool
|
OutputIsTerminal() bool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ func (t *Terminal) CanUpdateStatus() bool {
|
|||||||
return t.canUpdateStatus
|
return t.canUpdateStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OutputWriter returns a output writer that is safe for concurrent use with
|
||||||
|
// other output methods. Output is only shown after a line break.
|
||||||
func (t *Terminal) OutputWriter() io.Writer {
|
func (t *Terminal) OutputWriter() io.Writer {
|
||||||
t.outputWriterOnce.Do(func() {
|
t.outputWriterOnce.Do(func() {
|
||||||
t.outputWriter = newLineWriter(t.Print)
|
t.outputWriter = newLineWriter(t.Print)
|
||||||
@@ -171,7 +173,7 @@ func (t *Terminal) OutputWriter() io.Writer {
|
|||||||
return t.outputWriter
|
return t.outputWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
// OutputRaw returns the output writer. Should only be used if there is no
|
// OutputRaw returns the raw output writer. Should only be used if there is no
|
||||||
// other option. Must not be used in combination with Print, Error, SetStatus
|
// other option. Must not be used in combination with Print, Error, SetStatus
|
||||||
// or any other method that writes to the terminal.
|
// or any other method that writes to the terminal.
|
||||||
func (t *Terminal) OutputRaw() io.Writer {
|
func (t *Terminal) OutputRaw() io.Writer {
|
||||||
|
|||||||
Reference in New Issue
Block a user