-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(issue,mr) add close and merge sub commands
- Loading branch information
1 parent
0862f42
commit 27fc07a
Showing
8 changed files
with
174 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cmd | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/zaquestion/lab/internal/git" | ||
lab "github.com/zaquestion/lab/internal/gitlab" | ||
) | ||
|
||
var issueCloseCmd = &cobra.Command{ | ||
Use: "close [remote]", | ||
Aliases: []string{"delete"}, | ||
Short: "Close issue by id", | ||
Long: ``, | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
remote, id, err := parseArgsRemote(args) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if remote == "" { | ||
remote = forkedFromRemote | ||
} | ||
rn, err := git.PathWithNameSpace(remote) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
p, err := lab.FindProject(rn) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
err = lab.IssueClose(p.ID, int(id)) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
issueCmd.AddCommand(issueCloseCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cmd | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/zaquestion/lab/internal/git" | ||
lab "github.com/zaquestion/lab/internal/gitlab" | ||
) | ||
|
||
var mrCloseCmd = &cobra.Command{ | ||
Use: "close [remote]", | ||
Aliases: []string{"delete"}, | ||
Short: "Close mr by id", | ||
Long: ``, | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
remote, id, err := parseArgsRemote(args) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if remote == "" { | ||
remote = forkedFromRemote | ||
} | ||
rn, err := git.PathWithNameSpace(remote) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
p, err := lab.FindProject(rn) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
err = lab.MRClose(p.ID, int(id)) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
mrCmd.AddCommand(mrCloseCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cmd | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/zaquestion/lab/internal/git" | ||
lab "github.com/zaquestion/lab/internal/gitlab" | ||
) | ||
|
||
var mrMergeCmd = &cobra.Command{ | ||
Use: "merge [remote]", | ||
Aliases: []string{"delete"}, | ||
Short: "Merge mr by id", | ||
Long: ``, | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
remote, id, err := parseArgsRemote(args) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if remote == "" { | ||
remote = forkedFromRemote | ||
} | ||
rn, err := git.PathWithNameSpace(remote) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
p, err := lab.FindProject(rn) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
err = lab.MRMerge(p.ID, int(id)) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
mrCmd.AddCommand(mrMergeCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters