Skip to content

Commit

Permalink
Add -update / -u flag : runs spr update after amend
Browse files Browse the repository at this point in the history
commit-id:45465f69
  • Loading branch information
ejoffe authored and Eitan Joffe committed Jun 4, 2022
1 parent ef4add6 commit 9cfba23
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/amend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/ejoffe/spr/config"
"github.com/ejoffe/spr/git/realgit"
"github.com/ejoffe/spr/github/githubclient"
"github.com/ejoffe/spr/spr"
"github.com/jessevdk/go-flags"
"github.com/rs/zerolog"
Expand All @@ -23,6 +24,7 @@ var (
type opts struct {
Debug bool `short:"d" long:"debug" description:"Show verbose debug info."`
Version bool `short:"v" long:"version" description:"Show version."`
Update bool `short:"u" long:"update" description:"Run spr update after amend."`
}

func init() {
Expand Down Expand Up @@ -54,12 +56,17 @@ func main() {
os.Exit(2)
}

ctx := context.Background()
cfg := config.ParseConfig(gitcmd)
client := githubclient.NewGitHubClient(ctx, cfg)
gitcmd = realgit.NewGitCmd(cfg)
ctx := context.Background()

sd := spr.NewStackedPR(cfg, nil, gitcmd)
sd := spr.NewStackedPR(cfg, client, gitcmd)
sd.AmendCommit(ctx)

if opts.Update {
sd.UpdatePullRequests(ctx, nil, nil)
}
}

func check(err error) {
Expand Down

0 comments on commit 9cfba23

Please sign in to comment.