mirror of https://github.com/restic/restic.git
Renames to fix clashes with reserved words.
This commit is contained in:
parent
44bf8dc582
commit
cb746265c1
|
@ -82,10 +82,10 @@ func printProgress(status string, final bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var carriageControl, clear string
|
var carriageControl, cl string
|
||||||
|
|
||||||
if canUpdateStatus {
|
if canUpdateStatus {
|
||||||
clear = clearLine(w)
|
cl = clearLine(w)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !(strings.HasSuffix(status, "\r") || strings.HasSuffix(status, "\n")) {
|
if !(strings.HasSuffix(status, "\r") || strings.HasSuffix(status, "\n")) {
|
||||||
|
@ -96,7 +96,7 @@ func printProgress(status string, final bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = os.Stdout.Write([]byte(clear + status + carriageControl))
|
_, _ = os.Stdout.Write([]byte(cl + status + carriageControl))
|
||||||
if final {
|
if final {
|
||||||
_, _ = os.Stdout.Write([]byte("\n"))
|
_, _ = os.Stdout.Write([]byte("\n"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,10 +421,10 @@ func (be *Backend) List(ctx context.Context, t backend.FileType, fn func(backend
|
||||||
prefix += "/"
|
prefix += "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
max := int32(be.listMaxItems)
|
maxI := int32(be.listMaxItems)
|
||||||
|
|
||||||
opts := &azContainer.ListBlobsFlatOptions{
|
opts := &azContainer.ListBlobsFlatOptions{
|
||||||
MaxResults: &max,
|
MaxResults: &maxI,
|
||||||
Prefix: &prefix,
|
Prefix: &prefix,
|
||||||
}
|
}
|
||||||
lister := be.container.NewListBlobsFlatPager(opts)
|
lister := be.container.NewListBlobsFlatPager(opts)
|
||||||
|
|
|
@ -47,8 +47,8 @@ func SplitShellStrings(data string) (strs []string, err error) {
|
||||||
|
|
||||||
// derived from strings.SplitFunc
|
// derived from strings.SplitFunc
|
||||||
fieldStart := -1 // Set to -1 when looking for start of field.
|
fieldStart := -1 // Set to -1 when looking for start of field.
|
||||||
for i, rune := range data {
|
for i, r := range data {
|
||||||
if s.isSplitChar(rune) {
|
if s.isSplitChar(r) {
|
||||||
if fieldStart >= 0 {
|
if fieldStart >= 0 {
|
||||||
strs = append(strs, data[fieldStart:i])
|
strs = append(strs, data[fieldStart:i])
|
||||||
fieldStart = -1
|
fieldStart = -1
|
||||||
|
|
|
@ -53,12 +53,12 @@ func FormatDuration(d time.Duration) string {
|
||||||
func FormatSeconds(sec uint64) string {
|
func FormatSeconds(sec uint64) string {
|
||||||
hours := sec / 3600
|
hours := sec / 3600
|
||||||
sec -= hours * 3600
|
sec -= hours * 3600
|
||||||
min := sec / 60
|
mins := sec / 60
|
||||||
sec -= min * 60
|
sec -= mins * 60
|
||||||
if hours > 0 {
|
if hours > 0 {
|
||||||
return fmt.Sprintf("%d:%02d:%02d", hours, min, sec)
|
return fmt.Sprintf("%d:%02d:%02d", hours, mins, sec)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%d:%02d", min, sec)
|
return fmt.Sprintf("%d:%02d", mins, sec)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseBytes parses a size in bytes from s. It understands the suffixes
|
// ParseBytes parses a size in bytes from s. It understands the suffixes
|
||||||
|
|
|
@ -29,8 +29,8 @@ func NewCounter(interval time.Duration, total uint64, report Func) *Counter {
|
||||||
max: total,
|
max: total,
|
||||||
}
|
}
|
||||||
c.Updater = *NewUpdater(interval, func(runtime time.Duration, final bool) {
|
c.Updater = *NewUpdater(interval, func(runtime time.Duration, final bool) {
|
||||||
v, max := c.Get()
|
v, maxV := c.Get()
|
||||||
report(v, max, runtime, final)
|
report(v, maxV, runtime, final)
|
||||||
})
|
})
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,34 +24,34 @@ func TestSetStatus(t *testing.T) {
|
||||||
go term.Run(ctx)
|
go term.Run(ctx)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
clear = posixControlClearLine
|
cl = posixControlClearLine
|
||||||
home = posixControlMoveCursorHome
|
home = posixControlMoveCursorHome
|
||||||
up = posixControlMoveCursorUp
|
up = posixControlMoveCursorUp
|
||||||
)
|
)
|
||||||
|
|
||||||
term.SetStatus([]string{"first"})
|
term.SetStatus([]string{"first"})
|
||||||
exp := home + clear + "first" + home
|
exp := home + cl + "first" + home
|
||||||
|
|
||||||
term.SetStatus([]string{""})
|
term.SetStatus([]string{""})
|
||||||
exp += home + clear + "" + home
|
exp += home + cl + "" + home
|
||||||
|
|
||||||
term.SetStatus([]string{})
|
term.SetStatus([]string{})
|
||||||
exp += home + clear + "" + home
|
exp += home + cl + "" + home
|
||||||
|
|
||||||
// already empty status
|
// already empty status
|
||||||
term.SetStatus([]string{})
|
term.SetStatus([]string{})
|
||||||
|
|
||||||
term.SetStatus([]string{"foo", "bar", "baz"})
|
term.SetStatus([]string{"foo", "bar", "baz"})
|
||||||
exp += home + clear + "foo\n" + home + clear + "bar\n" +
|
exp += home + cl + "foo\n" + home + cl + "bar\n" +
|
||||||
home + clear + "baz" + home + up + up
|
home + cl + "baz" + home + up + up
|
||||||
|
|
||||||
term.SetStatus([]string{"quux", "needs\nquote"})
|
term.SetStatus([]string{"quux", "needs\nquote"})
|
||||||
exp += home + clear + "quux\n" +
|
exp += home + cl + "quux\n" +
|
||||||
home + clear + "\"needs\\nquote\"\n" +
|
home + cl + "\"needs\\nquote\"\n" +
|
||||||
home + clear + home + up + up // Clear third line
|
home + cl + home + up + up // Clear third line
|
||||||
|
|
||||||
cancel()
|
cancel()
|
||||||
exp += home + clear + "\n" + home + clear + home + up // Status cleared
|
exp += home + cl + "\n" + home + cl + home + up // Status cleared
|
||||||
|
|
||||||
<-term.closed
|
<-term.closed
|
||||||
rtest.Equals(t, exp, buf.String())
|
rtest.Equals(t, exp, buf.String())
|
||||||
|
|
Loading…
Reference in New Issue