Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ linctl issue update LIN-123 --state "In Progress"
linctl issue update LIN-123 --priority 1 # 0=None, 1=Urgent, 2=High, 3=Normal, 4=Low
linctl issue update LIN-123 --due-date "2024-12-31"
linctl issue update LIN-123 --due-date "" # Remove due date
linctl issue update LIN-123 --parent LIN-456 # Set parent issue
linctl issue update LIN-123 --parent none # Remove parent

# Update multiple fields at once
linctl issue update LIN-123 --title "Critical Bug" --assignee me --priority 1
linctl issue update LIN-123 --parent LIN-456 --title "Sub-task" --assignee me
```

### 3. Project Management
Expand Down Expand Up @@ -260,6 +263,7 @@ linctl issue edit <issue-id> [flags] # Alias
-s, --state string State name (e.g., 'Todo', 'In Progress', 'Done')
--priority int Priority (0=None, 1=Urgent, 2=High, 3=Normal, 4=Low)
--due-date string Due date (YYYY-MM-DD format, or empty to remove)
--parent string Parent issue ID/identifier (or 'none' to remove parent)

# Archive issue (coming soon)
linctl issue archive <issue-id>
Expand Down Expand Up @@ -619,6 +623,13 @@ linctl team members ENG --json | jq '. | length'

# Export issue comments
linctl comment list LIN-123 --json > issue-comments.json

# Set up parent-child issue relationships
linctl issue update LIN-124 --parent LIN-123 # Make LIN-124 a sub-issue of LIN-123
linctl issue update LIN-125 --parent LIN-123 # Make LIN-125 also a sub-issue

# Remove parent-child relationships
linctl issue update LIN-124 --parent none
```

## 📡 Real-World Examples
Expand Down
40 changes: 40 additions & 0 deletions cmd/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,8 @@ Examples:
linctl issue update LIN-123 --state "In Progress"
linctl issue update LIN-123 --priority 1
linctl issue update LIN-123 --due-date "2024-12-31"
linctl issue update LIN-123 --parent LIN-100 # Make sub-issue of LIN-100
linctl issue update LIN-123 --parent none # Remove parent (promote to top-level)
linctl issue update LIN-123 --title "New title" --assignee me --priority 2`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -1049,6 +1051,34 @@ Examples:
}
}

// Handle parent update
if cmd.Flags().Changed("parent") {
parentValue, _ := cmd.Flags().GetString("parent")
normalizedValue := strings.ToLower(strings.TrimSpace(parentValue))

switch normalizedValue {
case "none", "null", "":
// Remove parent relationship (promote to top-level issue)
input["parentId"] = nil
default:
// Validate that the parent issue exists
parentIssue, err := client.GetIssue(context.Background(), parentValue)
if err != nil {
output.Error(fmt.Sprintf("Failed to find parent issue '%s': %v", parentValue, err), plaintext, jsonOut)
os.Exit(1)
}

// Prevent self-referencing
currentIssueID := args[0]
if parentIssue.Identifier == currentIssueID || parentIssue.ID == currentIssueID {
output.Error("An issue cannot be its own parent", plaintext, jsonOut)
os.Exit(1)
}

input["parentId"] = parentIssue.ID
}
}

// Check if any updates were specified
if len(input) == 0 {
output.Error("No updates specified. Use flags to specify what to update.", plaintext, jsonOut)
Expand All @@ -1066,8 +1096,17 @@ Examples:
output.JSON(issue)
} else if plaintext {
fmt.Printf("Updated issue %s\n", issue.Identifier)
if issue.Parent != nil {
fmt.Printf("Parent: %s - %s\n", issue.Parent.Identifier, issue.Parent.Title)
}
} else {
output.Success(fmt.Sprintf("Updated issue %s", issue.Identifier), plaintext, jsonOut)
if issue.Parent != nil {
fmt.Printf(" %s Parent: %s - %s\n",
color.New(color.FgBlue).Sprint("↳"),
color.New(color.FgCyan).Sprint(issue.Parent.Identifier),
issue.Parent.Title)
}
}
},
}
Expand Down Expand Up @@ -1118,4 +1157,5 @@ func init() {
issueUpdateCmd.Flags().StringP("state", "s", "", "State name (e.g., 'Todo', 'In Progress', 'Done')")
issueUpdateCmd.Flags().Int("priority", -1, "Priority (0=None, 1=Urgent, 2=High, 3=Normal, 4=Low)")
issueUpdateCmd.Flags().String("due-date", "", "Due date (YYYY-MM-DD format, or empty to remove)")
issueUpdateCmd.Flags().String("parent", "", "Parent issue ID or identifier (use 'none' to remove parent)")
}
Loading