mirror of
https://gitea.com/gitea/tea.git
synced 2025-10-12 00:45:32 +02:00

committed by
Gitea

parent
1d233402fd
commit
7c024bcd69
31
cmd/pulls.go
31
cmd/pulls.go
@@ -5,14 +5,16 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var output string
|
||||
|
||||
// CmdPulls represents to login a gitea server.
|
||||
var CmdPulls = cli.Command{
|
||||
Name: "pulls",
|
||||
@@ -28,6 +30,11 @@ var CmdPulls = cli.Command{
|
||||
Name: "repo, r",
|
||||
Usage: "Indicate one repository, optional when inside a gitea repository",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "output, o",
|
||||
Usage: outputUsage,
|
||||
Destination: &output,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -43,8 +50,17 @@ func runPulls(ctx *cli.Context) error {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
headers := []string{
|
||||
"Index",
|
||||
"Name",
|
||||
"Updated",
|
||||
"Title",
|
||||
}
|
||||
|
||||
var values [][]string
|
||||
|
||||
if len(prs) == 0 {
|
||||
fmt.Println("No pull requests left")
|
||||
Output(output, headers, values)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -56,8 +72,17 @@ func runPulls(ctx *cli.Context) error {
|
||||
if len(name) == 0 {
|
||||
name = pr.Poster.UserName
|
||||
}
|
||||
fmt.Printf("#%d\t%s\t%s\t%s\n", pr.Index, name, pr.Updated.Format("2006-01-02 15:04:05"), pr.Title)
|
||||
values = append(
|
||||
values,
|
||||
[]string{
|
||||
strconv.FormatInt(pr.Index, 10),
|
||||
name,
|
||||
pr.Updated.Format("2006-01-02 15:04:05"),
|
||||
pr.Title,
|
||||
},
|
||||
)
|
||||
}
|
||||
Output(output, headers, values)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user