File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,17 @@ package worktree
33import (
44 "fmt"
55
6- ghapi "github.com/cli/go-gh/pkg/api "
6+ "github.com/cli/go-gh"
77 "github.com/despreston/gh-worktree/internal/worktree/commands/pr"
88 "github.com/spf13/cobra"
99)
1010
11- func New (restClient ghapi.RESTClient ) * cobra.Command {
11+ func New () (* cobra.Command , error ) {
12+ rest , err := gh .RESTClient (nil )
13+ if err != nil {
14+ return nil , err
15+ }
16+
1217 var rootCmd = & cobra.Command {
1318 Use : "worktree" ,
1419 Short : "Git worktrees, dawg" ,
@@ -18,6 +23,6 @@ func New(restClient ghapi.RESTClient) *cobra.Command {
1823 },
1924 }
2025
21- rootCmd .AddCommand (pr .New (restClient ))
22- return rootCmd
26+ rootCmd .AddCommand (pr .New (rest ))
27+ return rootCmd , nil
2328}
Original file line number Diff line number Diff line change @@ -4,18 +4,16 @@ import (
44 "fmt"
55 "os"
66
7- "github.com/cli/go-gh"
87 "github.com/despreston/gh-worktree/internal/worktree"
98)
109
1110func main () {
12- rest , err := gh . RESTClient ( nil )
11+ cmd , err := worktree . New ( )
1312 if err != nil {
1413 fmt .Fprintln (os .Stderr , err )
1514 os .Exit (1 )
1615 }
1716
18- cmd := worktree .New (rest )
1917 if err := cmd .Execute (); err != nil {
2018 fmt .Fprintln (os .Stderr , err )
2119 os .Exit (1 )
You can’t perform that action at this time.
0 commit comments