Skip to content

Commit 085e17a

Browse files
committed
Merge pull request git-lfs#258 from github/concurrent-uploads
Support concurrent uploads
2 parents 8bb6b26 + 2b1d10d commit 085e17a

28 files changed

+552
-240
lines changed

.vendor/src/github.com/cheggaaa/pb/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ bar.ShowTimeLeft = true
5757
// show average speed
5858
bar.ShowSpeed = true
5959

60+
// sets the width of the progress bar
61+
bar.SetWidth(80)
62+
63+
// sets the width of the progress bar, but if terminal size smaller will be ignored
64+
bar.SetMaxWidth(80)
65+
6066
// convert output to readable format (like KB, MB)
6167
bar.SetUnits(pb.U_BYTES)
6268

.vendor/src/github.com/cheggaaa/pb/example/copy/copy.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package main
22

33
import (
4-
"github.com/cheggaaa/pb"
5-
"os"
64
"fmt"
5+
"github.com/cheggaaa/pb"
76
"io"
8-
"time"
9-
"strings"
107
"net/http"
8+
"os"
119
"strconv"
10+
"strings"
11+
"time"
1212
)
1313

1414
func main() {
@@ -18,12 +18,12 @@ func main() {
1818
return
1919
}
2020
sourceName, destName := os.Args[1], os.Args[2]
21-
21+
2222
// check source
2323
var source io.Reader
2424
var sourceSize int64
2525
if strings.HasPrefix(sourceName, "http://") {
26-
// open as url
26+
// open as url
2727
resp, err := http.Get(sourceName)
2828
if err != nil {
2929
fmt.Printf("Can't get %s: %v\n", sourceName, err)
@@ -54,30 +54,28 @@ func main() {
5454
sourceSize = sourceStat.Size()
5555
source = s
5656
}
57-
58-
59-
57+
6058
// create dest
6159
dest, err := os.Create(destName)
6260
if err != nil {
6361
fmt.Printf("Can't create %s: %v\n", destName, err)
6462
return
6563
}
6664
defer dest.Close()
67-
68-
// create bar
65+
66+
// create bar
6967
bar := pb.New(int(sourceSize)).SetUnits(pb.U_BYTES).SetRefreshRate(time.Millisecond * 10)
7068
bar.ShowSpeed = true
7169
bar.Start()
72-
70+
7371
// create multi writer
7472
writer := io.MultiWriter(dest, bar)
75-
73+
7674
// and copy
7775
io.Copy(writer, source)
7876
bar.Finish()
7977
}
8078

8179
func printUsage() {
8280
fmt.Println("copy [source file or url] [dest file]")
83-
}
81+
}

.vendor/src/github.com/cheggaaa/pb/format.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@ import (
66
"strings"
77
)
88

9+
type Units int
10+
911
const (
1012
// By default, without type handle
11-
U_NO = 0
13+
U_NO Units = iota
1214
// Handle as b, Kb, Mb, etc
13-
U_BYTES = 1
15+
U_BYTES
1416
)
1517

1618
// Format integer
17-
func Format(i int64, units int) string {
19+
func Format(i int64, units Units) string {
1820
switch units {
1921
case U_BYTES:
2022
return FormatBytes(i)
23+
default:
24+
// by default just convert to string
25+
return strconv.FormatInt(i, 10)
2126
}
22-
// by default just convert to string
23-
return strconv.Itoa(int(i))
2427
}
2528

2629
// Convert bytes to human readable string. Like a 2 MB, 64.2 KB, 52 B

0 commit comments

Comments
 (0)