Added title and description for CREATE ISSUE CLI
This commit is contained in:
@@ -1,13 +1,19 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/LazyBachelor/LazyPM/internal/models"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
createTitle string
|
||||||
|
createDescription string
|
||||||
|
)
|
||||||
|
|
||||||
var createCmd = &cobra.Command{
|
var createCmd = &cobra.Command{
|
||||||
Use: "create",
|
Use: "create",
|
||||||
Short: "Create a new issue",
|
Short: "Create a new issue",
|
||||||
@@ -15,10 +21,16 @@ var createCmd = &cobra.Command{
|
|||||||
RunE: runCreateCmd,
|
RunE: runCreateCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
createCmd.Flags().StringVar(&createTitle, "title", "", "Issue title")
|
||||||
|
_ = createCmd.MarkFlagRequired("title")
|
||||||
|
createCmd.Flags().StringVar(&createDescription, "desc", "", "Issue description")
|
||||||
|
}
|
||||||
|
|
||||||
func runCreateCmd(cmd *cobra.Command, args []string) error {
|
func runCreateCmd(cmd *cobra.Command, args []string) error {
|
||||||
issue := &models.Issue{
|
issue := &models.Issue{
|
||||||
Title: "test",
|
Title: createTitle,
|
||||||
Description: "This is a test issue created by the CLI.",
|
Description: createDescription,
|
||||||
Status: models.StatusOpen,
|
Status: models.StatusOpen,
|
||||||
IssueType: models.TypeBug,
|
IssueType: models.TypeBug,
|
||||||
Priority: 0,
|
Priority: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user