diff --git a/internal/commands/issues/dependencies.go b/internal/commands/issues/dependencies.go index 57fbe3b..19d2520 100644 --- a/internal/commands/issues/dependencies.go +++ b/internal/commands/issues/dependencies.go @@ -15,9 +15,10 @@ pm dep remove ISSUE-1 ISSUE-2` // DepCmd manages dependencies for issues. // Default behavior: view dependencies of an issue. var DepCmd = &cobra.Command{ - Use: "dep [subcommand] [issue id]", + Use: "dep [issue id]", Short: "Manage dependencies for an issue", Long: `Manage dependencies between issues.`, + Aliases: []string{"dependencies"}, Example: depCmdExample, // This command runs only when no subcommand is provided. @@ -29,14 +30,14 @@ var DepCmd = &cobra.Command{ var DepViewCmd = &cobra.Command{ Use: "view [issue id]", Short: "View dependencies of an issue", - Aliases: []string{"list", "show"}, + Aliases: []string{"show"}, Args: cobra.ExactArgs(1), ValidArgsFunction: completeIssues, RunE: runDepViewCmd, } var DepAddCmd = &cobra.Command{ - Use: "add ", + Use: "add [issue id] [depends-on id]", Short: "Add a dependency: issue depends on depends-on issue", Args: cobra.ExactArgs(2), ValidArgsFunction: completeIssues, @@ -44,17 +45,15 @@ var DepAddCmd = &cobra.Command{ } var DepRemoveCmd = &cobra.Command{ - Use: "remove ", + Use: "remove [issue id] [depends-on id]", Short: "Remove an existing dependency", - Aliases: []string{"rm"}, + Aliases: []string{"rm"}, Args: cobra.ExactArgs(2), ValidArgsFunction: completeIssues, RunE: runDepRemoveCmd, } func init() { - DepCmd.Aliases = []string{"dependencies"} - DepCmd.AddCommand(DepViewCmd) DepCmd.AddCommand(DepAddCmd) 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) return runDepViewCmd(cmd, []string{issueID}) } - diff --git a/pkg/repl/executor.go b/pkg/repl/executor.go index 6897396..d12a89c 100644 --- a/pkg/repl/executor.go +++ b/pkg/repl/executor.go @@ -28,12 +28,6 @@ func (r *REPL) execute(input string) (string, error) { if after, ok := strings.CutPrefix(input, "pm"); ok { 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 } diff --git a/pkg/repl/suggestions.go b/pkg/repl/suggestions.go index 30d5a20..d7f8c17 100644 --- a/pkg/repl/suggestions.go +++ b/pkg/repl/suggestions.go @@ -23,6 +23,7 @@ var rootSuggestions = []prompt.Suggest{ var baseSuggestions = []prompt.Suggest{ {Text: "help", Description: "Show help information"}, {Text: "sprint", Description: "Manage sprints"}, + {Text: "dep", Description: "Manage dependencies"}, {Text: "create", Description: "Create a new issue with title"}, {Text: "list", Description: "List all issues"}, {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: "comment", Description: "Add a comment 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: "ls", Description: "Alias for list command"}, @@ -42,6 +42,7 @@ var baseSuggestions = []prompt.Suggest{ {Text: "rm", Description: "Alias for delete command"}, {Text: "del", Description: "Alias for delete 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. @@ -126,7 +127,6 @@ var sprintSubcommands = []prompt.Suggest{ var depSubcommands = []prompt.Suggest{ {Text: "view", Description: "View dependencies of an issue"}, - {Text: "list", Description: "Alias for view"}, {Text: "show", Description: "Alias for view"}, {Text: "add", Description: "Add 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, " ") { sub := words[1] 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. return issueIDSuggestions("", true) default: