Skip to content

Commit 3d6c663

Browse files
Add name flag to add custom issue name
1 parent 546f329 commit 3d6c663

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

cmd/issuectl/start.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type CLIOverwrites struct {
1313
Profile string
1414
IssueBackend string
1515
RepoBackend string
16+
IssueName string
1617
}
1718

1819
var Flags CLIOverwrites
@@ -62,7 +63,7 @@ func initStartCommand(rootCmd *cobra.Command) {
6263
if err != nil {
6364
return err
6465
}
65-
if err := issuectl.StartWorkingOnIssue(config.GetPersistent(), issuectl.IssueID(args[0])); err != nil {
66+
if err := issuectl.StartWorkingOnIssue(Flags.IssueName, config.GetPersistent(), issuectl.IssueID(args[0])); err != nil {
6667
// TODO: rollback changes made by StartWorkingOnIssue
6768
return err
6869
}
@@ -103,5 +104,13 @@ func initStartCommand(rootCmd *cobra.Command) {
103104
"Name of repo backend to use for command",
104105
)
105106

107+
startCmd.PersistentFlags().StringVarP(
108+
&Flags.IssueName,
109+
"name",
110+
"n",
111+
"",
112+
"Custom issue name to use [defaults to IssueID]. IssueID will be added as prefix of custom name.",
113+
)
114+
106115
rootCmd.AddCommand(startCmd)
107116
}

pkg/issue.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
)
2121

2222
// StartWorkingOnIssue starts work on an issue
23-
func StartWorkingOnIssue(config IssuectlConfig, issueID IssueID) error {
23+
func StartWorkingOnIssue(customIssueName string, config IssuectlConfig, issueID IssueID) error {
2424
profile := config.GetProfile(config.GetCurrentProfile())
2525
repositories := []string{}
2626
for _, repoName := range profile.Repositories {
@@ -34,6 +34,9 @@ func StartWorkingOnIssue(config IssuectlConfig, issueID IssueID) error {
3434
Log.Infofp("🏗️", "Preparing workspace for issue %v...", issueID)
3535

3636
name := string(issueID)
37+
if customIssueName != "" {
38+
name = fmt.Sprintf("%v-%v", name, customIssueName)
39+
}
3740
dirName := name
3841
branchName := name
3942

0 commit comments

Comments
 (0)