package cmd
import (
"fmt"
"github.com/spf13/cobra"
cliErrors "gitlab.com/pcanilho/go-jira-cli/cmd/errors"
"strings"
)
var addCmd = &cobra.Command{
Use: "add",
Short: "Specifies that property is to be added to the issue",
}
var commentCmd = &cobra.Command{
Use: "comment",
Short: "Add a comment to the desired issue",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("please specify the issue identifier to update")
}
if len(strings.TrimSpace(commentBody)) == 0 {
return fmt.Errorf("please specify a message to be added as a comment to the ticket")
}
comment, err := jiraController.AddCommentToIssue(args[0], commentBody)
if err != nil {
return cliErrors.NewCliError(err)
}
// Set output
output, outputExpanded = comment.ID, comment
return nil
},
}
func init() {
// Comment
commentCmd.Flags().StringVarP(&commentBody, "body", "b", "", "the comment body to be added to the issue")
// Add sub-commands
addCmd.AddCommand(commentCmd)
}
|
The pages are generated with Golds v0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |