"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/cmd/run/list/list.go" between
gh-cli-1.10.3.tar.gz and gh-cli-1.11.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

list.go  (gh-cli-1.10.3):list.go  (gh-cli-1.11.0)
package list package list
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"time"
"github.com/cli/cli/api" "github.com/cli/cli/api"
"github.com/cli/cli/internal/ghrepo" "github.com/cli/cli/internal/ghrepo"
"github.com/cli/cli/pkg/cmd/run/shared" "github.com/cli/cli/pkg/cmd/run/shared"
workflowShared "github.com/cli/cli/pkg/cmd/workflow/shared" workflowShared "github.com/cli/cli/pkg/cmd/workflow/shared"
"github.com/cli/cli/pkg/cmdutil" "github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/iostreams" "github.com/cli/cli/pkg/iostreams"
"github.com/cli/cli/utils" "github.com/cli/cli/utils"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
skipping to change at line 111 skipping to change at line 112
if len(runs) == 0 { if len(runs) == 0 {
if !opts.PlainOutput { if !opts.PlainOutput {
fmt.Fprintln(opts.IO.ErrOut, "No runs found") fmt.Fprintln(opts.IO.ErrOut, "No runs found")
} }
return nil return nil
} }
out := opts.IO.Out out := opts.IO.Out
if !opts.PlainOutput {
tp.AddField("STATUS", nil, nil)
tp.AddField("NAME", nil, nil)
tp.AddField("WORKFLOW", nil, nil)
tp.AddField("BRANCH", nil, nil)
tp.AddField("EVENT", nil, nil)
tp.AddField("ID", nil, nil)
tp.AddField("ELAPSED", nil, nil)
tp.AddField("AGE", nil, nil)
tp.EndRow()
}
for _, run := range runs { for _, run := range runs {
if opts.PlainOutput { if opts.PlainOutput {
tp.AddField(string(run.Status), nil, nil) tp.AddField(string(run.Status), nil, nil)
tp.AddField(string(run.Conclusion), nil, nil) tp.AddField(string(run.Conclusion), nil, nil)
} else { } else {
symbol, symbolColor := shared.Symbol(cs, run.Status, run. Conclusion) symbol, symbolColor := shared.Symbol(cs, run.Status, run. Conclusion)
tp.AddField(symbol, nil, symbolColor) tp.AddField(symbol, nil, symbolColor)
} }
tp.AddField(run.CommitMsg(), nil, cs.Bold) tp.AddField(run.CommitMsg(), nil, cs.Bold)
tp.AddField(run.Name, nil, nil) tp.AddField(run.Name, nil, nil)
tp.AddField(run.HeadBranch, nil, cs.Bold) tp.AddField(run.HeadBranch, nil, cs.Bold)
tp.AddField(string(run.Event), nil, nil) tp.AddField(string(run.Event), nil, nil)
if opts.PlainOutput {
elapsed := run.UpdatedAt.Sub(run.CreatedAt)
if elapsed < 0 {
elapsed = 0
}
tp.AddField(elapsed.String(), nil, nil)
}
tp.AddField(fmt.Sprintf("%d", run.ID), nil, cs.Cyan) tp.AddField(fmt.Sprintf("%d", run.ID), nil, cs.Cyan)
elapsed := run.UpdatedAt.Sub(run.CreatedAt)
if elapsed < 0 {
elapsed = 0
}
tp.AddField(elapsed.String(), nil, nil)
tp.AddField(utils.FuzzyAgoAbbr(time.Now(), run.CreatedAt), nil, n
il)
tp.EndRow() tp.EndRow()
} }
err = tp.Render() err = tp.Render()
if err != nil { if err != nil {
return err return err
} }
if !opts.PlainOutput { if !opts.PlainOutput {
fmt.Fprintln(out) fmt.Fprintln(out)
 End of changes. 4 change blocks. 
9 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)