Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Command = &cli.Command{ Name: "log", Usage: "Output updates about a changeset", UsageText: "log [options] <changeID>", Flags: flagset.Extract(config), Action: func(ctx *cli.Context) error { gerritAPI := common.GerritAPI(ctx.Context) changeID := ctx.Args().Get(0) accountInfo := make(map[int64]gerrit.AccountInfo) getAccountInfo := func(accountID int64) (*gerrit.AccountInfo, error) { info, ok := accountInfo[accountID] if !ok { info, err := gerritAPI.Client.GetAccountInfo(ctx.Context, strconv.FormatInt(accountID, 10)) if err != nil { return nil, err } accountInfo[accountID] = info } return &info, nil } changeInfo, err := gerritAPI.Client.GetChangeDetail(ctx.Context, changeID) if err != nil { return err } sort.Slice(changeInfo.Messages, func(i, j int) bool { a := changeInfo.Messages[i].Time.Time() b := changeInfo.Messages[j].Time.Time() return b.Before(a) }) for _, message := range changeInfo.Messages { message.Author, _ = getAccountInfo(message.Author.NumericID) } template, err := template.New("log"). Funcs(map[string]interface{}{ "baseURL": func() string { return gerritAPI.BaseURL }, "getAccountInfo": getAccountInfo, "formatTimeStamp": func(t gerrit.TimeStamp) string { return t.Time().Local().Format(time.RFC1123Z) }, }). Parse(log) if err != nil { return err } return template.Execute(ctx.App.Writer, changeInfo) }, HideHelpCommand: true, } )
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.