Merge pull request #1141 from harshavardhana/newcp-bar
Rename newCpBar to newProgressBar, move setting console color for pro…
This commit is contained in:
+2
-1
@@ -218,7 +218,7 @@ func doCopyCmdSession(session *sessionV2) {
|
||||
|
||||
var bar barSend
|
||||
if !globalQuietFlag && !globalJSONFlag { // set up progress bar
|
||||
bar = newCpBar()
|
||||
bar = newProgressBar()
|
||||
bar.Extend(session.Header.TotalBytes)
|
||||
}
|
||||
|
||||
@@ -321,6 +321,7 @@ func mainCopy(ctx *cli.Context) {
|
||||
|
||||
console.SetCustomTheme(map[string]*color.Color{
|
||||
"Copy": color.New(color.FgGreen, color.Bold),
|
||||
"Bar": color.New(color.FgGreen, color.Bold),
|
||||
})
|
||||
|
||||
session := newSessionV2()
|
||||
|
||||
+2
-1
@@ -218,7 +218,7 @@ func doMirrorCmdSession(session *sessionV2) {
|
||||
// Set up progress bar.
|
||||
var bar barSend
|
||||
if !globalQuietFlag && !globalJSONFlag {
|
||||
bar = newCpBar()
|
||||
bar = newProgressBar()
|
||||
bar.Extend(session.Header.TotalBytes)
|
||||
}
|
||||
|
||||
@@ -321,6 +321,7 @@ func mainMirror(ctx *cli.Context) {
|
||||
|
||||
console.SetCustomTheme(map[string]*color.Color{
|
||||
"Mirror": color.New(color.FgGreen, color.Bold),
|
||||
"Bar": color.New(color.FgGreen, color.Bold),
|
||||
})
|
||||
|
||||
var e error
|
||||
|
||||
@@ -145,8 +145,8 @@ func getFixedWidth(width, percent int) int {
|
||||
return width * percent / 100
|
||||
}
|
||||
|
||||
// newCpBar - instantiate a pbBar.
|
||||
func newCpBar() barSend {
|
||||
// newProgressBar - instantiate a pbBar.
|
||||
func newProgressBar() barSend {
|
||||
cmdCh := make(chan barMsg)
|
||||
finishCh := make(chan bool)
|
||||
go func(cmdCh <-chan barMsg, finishCh chan<- bool) {
|
||||
|
||||
@@ -47,7 +47,6 @@ var Theme = map[string]*color.Color{
|
||||
"Fatal": color.New(color.FgRed, color.Italic, color.Bold),
|
||||
"Error": color.New(color.FgYellow, color.Italic),
|
||||
"Info": color.New(color.FgGreen, color.Bold),
|
||||
"Bar": color.New(color.FgGreen, color.Bold),
|
||||
"Print": color.New(),
|
||||
"PrintC": color.New(color.FgGreen, color.Bold),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user