fix
This commit is contained in:
@@ -15,9 +15,10 @@ pm dep remove ISSUE-1 ISSUE-2`
|
|||||||
// DepCmd manages dependencies for issues.
|
// DepCmd manages dependencies for issues.
|
||||||
// Default behavior: view dependencies of an issue.
|
// Default behavior: view dependencies of an issue.
|
||||||
var DepCmd = &cobra.Command{
|
var DepCmd = &cobra.Command{
|
||||||
Use: "dep [subcommand] [issue id]",
|
Use: "dep [issue id]",
|
||||||
Short: "Manage dependencies for an issue",
|
Short: "Manage dependencies for an issue",
|
||||||
Long: `Manage dependencies between issues.`,
|
Long: `Manage dependencies between issues.`,
|
||||||
|
Aliases: []string{"dependencies"},
|
||||||
Example: depCmdExample,
|
Example: depCmdExample,
|
||||||
|
|
||||||
// This command runs only when no subcommand is provided.
|
// This command runs only when no subcommand is provided.
|
||||||
@@ -29,14 +30,14 @@ var DepCmd = &cobra.Command{
|
|||||||
var DepViewCmd = &cobra.Command{
|
var DepViewCmd = &cobra.Command{
|
||||||
Use: "view [issue id]",
|
Use: "view [issue id]",
|
||||||
Short: "View dependencies of an issue",
|
Short: "View dependencies of an issue",
|
||||||
Aliases: []string{"list", "show"},
|
Aliases: []string{"show"},
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
ValidArgsFunction: completeIssues,
|
ValidArgsFunction: completeIssues,
|
||||||
RunE: runDepViewCmd,
|
RunE: runDepViewCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
var DepAddCmd = &cobra.Command{
|
var DepAddCmd = &cobra.Command{
|
||||||
Use: "add <issue id> <depends-on id>",
|
Use: "add [issue id] [depends-on id]",
|
||||||
Short: "Add a dependency: issue depends on depends-on issue",
|
Short: "Add a dependency: issue depends on depends-on issue",
|
||||||
Args: cobra.ExactArgs(2),
|
Args: cobra.ExactArgs(2),
|
||||||
ValidArgsFunction: completeIssues,
|
ValidArgsFunction: completeIssues,
|
||||||
@@ -44,17 +45,15 @@ var DepAddCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var DepRemoveCmd = &cobra.Command{
|
var DepRemoveCmd = &cobra.Command{
|
||||||
Use: "remove <issue id> <depends-on id>",
|
Use: "remove [issue id] [depends-on id]",
|
||||||
Short: "Remove an existing dependency",
|
Short: "Remove an existing dependency",
|
||||||
Aliases: []string{"rm"},
|
Aliases: []string{"rm"},
|
||||||
Args: cobra.ExactArgs(2),
|
Args: cobra.ExactArgs(2),
|
||||||
ValidArgsFunction: completeIssues,
|
ValidArgsFunction: completeIssues,
|
||||||
RunE: runDepRemoveCmd,
|
RunE: runDepRemoveCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
DepCmd.Aliases = []string{"dependencies"}
|
|
||||||
|
|
||||||
DepCmd.AddCommand(DepViewCmd)
|
DepCmd.AddCommand(DepViewCmd)
|
||||||
DepCmd.AddCommand(DepAddCmd)
|
DepCmd.AddCommand(DepAddCmd)
|
||||||
DepCmd.AddCommand(DepRemoveCmd)
|
DepCmd.AddCommand(DepRemoveCmd)
|
||||||
@@ -122,4 +121,3 @@ func runDepRemoveCmd(cmd *cobra.Command, args []string) error {
|
|||||||
cmd.Printf("Removed dependency: %s no longer depends on %s\n", issueID, dependsOnID)
|
cmd.Printf("Removed dependency: %s no longer depends on %s\n", issueID, dependsOnID)
|
||||||
return runDepViewCmd(cmd, []string{issueID})
|
return runDepViewCmd(cmd, []string{issueID})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,6 @@ func (r *REPL) execute(input string) (string, error) {
|
|||||||
if after, ok := strings.CutPrefix(input, "pm"); ok {
|
if after, ok := strings.CutPrefix(input, "pm"); ok {
|
||||||
|
|
||||||
if strings.Contains(strings.Split(after, " ")[1], "start") {
|
if strings.Contains(strings.Split(after, " ")[1], "start") {
|
||||||
//trimmedAfter := strings.TrimSpace(after)
|
|
||||||
//parts := shellSplit(trimmedAfter)
|
|
||||||
|
|
||||||
// Prevent accidental attempts to run "pm start ..." inside the REPL.
|
|
||||||
// (The REPL uses `status/title/help` and shell execution instead.)
|
|
||||||
//if len(parts) > 1 && strings.Contains(parts[1], "start") {
|
|
||||||
return "Nice try👻", nil
|
return "Nice try👻", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ var rootSuggestions = []prompt.Suggest{
|
|||||||
var baseSuggestions = []prompt.Suggest{
|
var baseSuggestions = []prompt.Suggest{
|
||||||
{Text: "help", Description: "Show help information"},
|
{Text: "help", Description: "Show help information"},
|
||||||
{Text: "sprint", Description: "Manage sprints"},
|
{Text: "sprint", Description: "Manage sprints"},
|
||||||
|
{Text: "dep", Description: "Manage dependencies"},
|
||||||
{Text: "create", Description: "Create a new issue with title"},
|
{Text: "create", Description: "Create a new issue with title"},
|
||||||
{Text: "list", Description: "List all issues"},
|
{Text: "list", Description: "List all issues"},
|
||||||
{Text: "read", Description: "Read issue details by ID"},
|
{Text: "read", Description: "Read issue details by ID"},
|
||||||
@@ -31,7 +32,6 @@ var baseSuggestions = []prompt.Suggest{
|
|||||||
{Text: "delete", Description: "Delete an issue by ID"},
|
{Text: "delete", Description: "Delete an issue by ID"},
|
||||||
{Text: "comment", Description: "Add a comment on an issue by ID"},
|
{Text: "comment", Description: "Add a comment on an issue by ID"},
|
||||||
{Text: "comments", Description: "List comments on an issue by ID"},
|
{Text: "comments", Description: "List comments on an issue by ID"},
|
||||||
{Text: "dep", Description: "Manage dependencies for an issue"},
|
|
||||||
|
|
||||||
{Text: "new", Description: "Alias for create command"},
|
{Text: "new", Description: "Alias for create command"},
|
||||||
{Text: "ls", Description: "Alias for list command"},
|
{Text: "ls", Description: "Alias for list command"},
|
||||||
@@ -42,6 +42,7 @@ var baseSuggestions = []prompt.Suggest{
|
|||||||
{Text: "rm", Description: "Alias for delete command"},
|
{Text: "rm", Description: "Alias for delete command"},
|
||||||
{Text: "del", Description: "Alias for delete command"},
|
{Text: "del", Description: "Alias for delete command"},
|
||||||
{Text: "get", Description: "Alias for read command"},
|
{Text: "get", Description: "Alias for read command"},
|
||||||
|
{Text: "dependencies", Description: "Alias for dep"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// createFlags is a list of prompt suggestions for the create command flags.
|
// createFlags is a list of prompt suggestions for the create command flags.
|
||||||
@@ -126,7 +127,6 @@ var sprintSubcommands = []prompt.Suggest{
|
|||||||
|
|
||||||
var depSubcommands = []prompt.Suggest{
|
var depSubcommands = []prompt.Suggest{
|
||||||
{Text: "view", Description: "View dependencies of an issue"},
|
{Text: "view", Description: "View dependencies of an issue"},
|
||||||
{Text: "list", Description: "Alias for view"},
|
|
||||||
{Text: "show", Description: "Alias for view"},
|
{Text: "show", Description: "Alias for view"},
|
||||||
{Text: "add", Description: "Add a dependency"},
|
{Text: "add", Description: "Add a dependency"},
|
||||||
{Text: "remove", Description: "Remove a dependency"},
|
{Text: "remove", Description: "Remove a dependency"},
|
||||||
@@ -223,7 +223,7 @@ func flagSuggestions(cmd string, words []string, text string) []prompt.Suggest {
|
|||||||
if strings.HasSuffix(text, " ") {
|
if strings.HasSuffix(text, " ") {
|
||||||
sub := words[1]
|
sub := words[1]
|
||||||
switch sub {
|
switch sub {
|
||||||
case "view", "list", "show", "add", "remove", "rm":
|
case "view", "show", "add", "remove", "rm":
|
||||||
// After a valid subcommand we expect the issue id next.
|
// After a valid subcommand we expect the issue id next.
|
||||||
return issueIDSuggestions("", true)
|
return issueIDSuggestions("", true)
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user