本文整理匯總了Golang中github.com/flynn/flynn/Godeps/_workspace/src/github.com/cheggaaa/pb.ProgressBar.NewProxyReader方法的典型用法代碼示例。如果您正苦於以下問題:Golang ProgressBar.NewProxyReader方法的具體用法?Golang ProgressBar.NewProxyReader怎麽用?Golang ProgressBar.NewProxyReader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/flynn/flynn/Godeps/_workspace/src/github.com/cheggaaa/pb.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.NewProxyReader方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: runImport
//.........這裏部分代碼省略.........
if !args.Bool["--quiet"] && uploadSize > 0 && term.IsTerminal(os.Stderr.Fd()) {
bar = pb.New(0)
bar.SetUnits(pb.U_BYTES)
bar.Total = uploadSize
bar.ShowSpeed = true
bar.Output = os.Stderr
bar.Start()
defer bar.Finish()
}
if pgDump != nil && release != nil {
res, err := client.ProvisionResource(&ct.ResourceReq{
ProviderID: "postgres",
Apps: []string{app.ID},
})
if err != nil {
return fmt.Errorf("error provisioning postgres resource: %s", err)
}
numResources++
if release.Env == nil {
release.Env = make(map[string]string, len(res.Env))
}
for k, v := range res.Env {
release.Env[k] = v
}
config, err := getPgRunConfig(client, app.ID, release)
if err != nil {
return fmt.Errorf("error getting postgres config: %s", err)
}
config.Stdin = pgDump
if bar != nil {
config.Stdin = bar.NewProxyReader(config.Stdin)
}
config.Exit = false
if err := pgRestore(client, config); err != nil {
return fmt.Errorf("error restoring postgres database: %s", err)
}
}
if release != nil && release.Env["FLYNN_REDIS"] != "" {
res, err := client.ProvisionResource(&ct.ResourceReq{
ProviderID: "redis",
Apps: []string{app.ID},
})
if err != nil {
return fmt.Errorf("error provisioning redis resource: %s", err)
}
numResources++
if release.Env == nil {
release.Env = make(map[string]string, len(res.Env))
}
for k, v := range res.Env {
release.Env[k] = v
}
}
uploadSlug := release != nil && release.Env["SLUG_URL"] != "" && artifact != nil && slug != nil
if uploadSlug {
// Use current slugrunner as the artifact
gitreceiveRelease, err := client.GetAppRelease("gitreceive")
if err != nil {
return fmt.Errorf("unable to retrieve gitreceive release: %s", err)