Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow updating parent on edit #765

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions internal/cmd/issue/edit/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ func edit(cmd *cobra.Command, args []string) {
body = md.ToJiraMD(body)
}

var parent string
if issue.Fields.Parent != nil {
parent := cmdutil.GetJiraIssueKey(project, params.parentIssueKey)
if parent == "" && issue.Fields.Parent != nil {
parent = issue.Fields.Parent.Key
}

Expand Down Expand Up @@ -301,6 +301,7 @@ func (ec *editCmd) askQuestions(issue *jira.Issue, originalBody string) error {

type editParams struct {
issueKey string
parentIssueKey string
summary string
body string
priority string
Expand All @@ -315,6 +316,9 @@ type editParams struct {
}

func parseArgsAndFlags(flags query.FlagParser, args []string, project string) *editParams {
parentIssueKey, err := flags.GetString("parent")
cmdutil.ExitIfError(err)

summary, err := flags.GetString("summary")
cmdutil.ExitIfError(err)

Expand Down Expand Up @@ -350,6 +354,7 @@ func parseArgsAndFlags(flags query.FlagParser, args []string, project string) *e

return &editParams{
issueKey: cmdutil.GetJiraIssueKey(project, args[0]),
parentIssueKey: parentIssueKey,
summary: summary,
body: body,
priority: priority,
Expand Down Expand Up @@ -430,6 +435,7 @@ func setFlags(cmd *cobra.Command) {

cmd.Flags().SortFlags = false

cmd.Flags().StringP("parent", "P", "", `Link to a parent key`)
cmd.Flags().StringP("summary", "s", "", "Edit summary or title")
cmd.Flags().StringP("body", "b", "", "Edit description")
cmd.Flags().StringP("priority", "y", "", "Edit priority")
Expand Down