refine architecture
change module name to repo
This commit is contained in:
34
pkg/cli/commands/create.go
Normal file
34
pkg/cli/commands/create.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create",
|
||||
Short: "Create a new issue",
|
||||
Long: `Create a new issue with the specified details.`,
|
||||
RunE: runCreateCmd,
|
||||
}
|
||||
|
||||
func runCreateCmd(cmd *cobra.Command, args []string) error {
|
||||
issue := &models.Issue{
|
||||
Title: "test",
|
||||
Description: "This is a test issue created by the CLI.",
|
||||
Status: models.StatusOpen,
|
||||
IssueType: models.TypeBug,
|
||||
Priority: 0,
|
||||
}
|
||||
|
||||
err := svc.Beads.CreateIssue(cmd.Context(), issue, "test_actor")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error creating issue: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("Created issue: %s\n", issue.ID)
|
||||
return nil
|
||||
}
|
||||
24
pkg/cli/commands/root.go
Normal file
24
pkg/cli/commands/root.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/LazyBachelor/LazyPM/internal/service"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var svc *service.Services
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "pm",
|
||||
Short: "Project Management CLI",
|
||||
Long: `Project Management CLI for managing issues and tasks.`,
|
||||
}
|
||||
|
||||
func Execute(services *service.Services) error {
|
||||
svc = services
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(createCmd)
|
||||
}
|
||||
Reference in New Issue
Block a user