forked from TrueCloudLab/restic
Dont't guess the max width, get it from the terminal
This commit is contained in:
parent
f05b0871e9
commit
374b1144de
1 changed files with 5 additions and 2 deletions
|
@ -88,8 +88,11 @@ var parser = flags.NewParser(&globalOpts, flags.HelpFlag|flags.PassDoubleDash)
|
||||||
// current windows cmd shell.
|
// current windows cmd shell.
|
||||||
func ClearLine() string {
|
func ClearLine() string {
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
// Ugly Workaround, write 79 Whitespaces and return
|
w, _, err := terminal.GetSize(int(os.Stdout.Fd()))
|
||||||
return " \r"
|
if err == nil {
|
||||||
|
return strings.Repeat(" ", w-1) + "\r"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
return "\x1b[2K"
|
return "\x1b[2K"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue