Repository: cli/cli
File: command/issue.go (Go)

Code before:
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
)

func init() {
	RootCmd.AddCommand(issueCmd)
	issueCmd.AddCommand(issueStatusCmd)

	issueCmd.AddCommand(issueCreateCmd)
	issueCreateCmd.Flags().StringP("title", "t", "",
		"Supply a title. Will prompt for one otherwise.")
	issueCreateCmd.Flags().StringP("body", "b", "",
		"Supply a body. Will prompt for one otherwise.")
	issueCreateCmd.Flags().BoolP("web", "w", false, "Open the browser to create an issue")
	issueCreateCmd.Flags().StringSliceP("assignee", "a", nil, "Assign a person by their `login`")
	issueCreateCmd.Flags().StringSliceP("label", "l", nil, "Add a label by `name`")
	issueCreateCmd.Flags().StringSliceP("project", "p", nil, "Add the issue to a project by `name`")
	issueCreateCmd.Flags().StringP("milestone", "m", "", "Add the issue to a milestone by `name`")

	issueCmd.AddCommand(issueListCmd)
	issueListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee")
	issueListCmd.Flags().StringSliceP("label", "l", nil, "Filter by label")
	issueListCmd.Flags().StringP("state", "s", "open", "Filter by state: {open|closed|all}")
	issueListCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch")
	issueListCmd.Flags().StringP("author", "A", "", "Filter by author")
	issueListCmd.Flags().StringP("mentioned", "", "", "Filter by mention")
	issueListCmd.Flags().StringP("milestone", "", "", "Filter by milestone")

	issueCmd.AddCommand(issueViewCmd)
	issueViewCmd.Flags().BoolP("web", "w", false, "Open an issue in the browser")

	issueCmd.AddCommand(issueCloseCmd)
	issueCmd.AddCommand(issueReopenCmd)
}

var issueCmd = &cobra.Command{
	Use:   "issue <command>",
	Short: "Create and view issues",
	Long:  `Work with GitHub issues`,
	Example: heredoc.Doc(`
	$ gh issue list
	$ gh issue create --label bug
	$ gh issue view --web
	`),
	Annotations: map[string]string{
		"IsCore": "true",
		"help:arguments": `An issue can be supplied as argument in any of the following formats:
- by number, e.g. "123"; or
- by URL, e.g. "https://github.com/OWNER/REPO/issues/123".`},
}
var issueCreateCmd = &cobra.Command{

Review comment (suggestion):
I'm not 100% sold on "mentioned" since it's past tense. How about present tense, e.g. `--mentions ampinsk`? @ampinsk: would love to know your thougths.

Code after:
	"github.com/cli/cli/utils"
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
)

func init() {
	RootCmd.AddCommand(issueCmd)
	issueCmd.AddCommand(issueStatusCmd)

	issueCmd.AddCommand(issueCreateCmd)
	issueCreateCmd.Flags().StringP("title", "t", "",
		"Supply a title. Will prompt for one otherwise.")
	issueCreateCmd.Flags().StringP("body", "b", "",
		"Supply a body. Will prompt for one otherwise.")
	issueCreateCmd.Flags().BoolP("web", "w", false, "Open the browser to create an issue")
	issueCreateCmd.Flags().StringSliceP("assignee", "a", nil, "Assign people by their `login`")
	issueCreateCmd.Flags().StringSliceP("label", "l", nil, "Add labels by `name`")
	issueCreateCmd.Flags().StringSliceP("project", "p", nil, "Add the issue to projects by `name`")
	issueCreateCmd.Flags().StringP("milestone", "m", "", "Add the issue to a milestone by `name`")

	issueCmd.AddCommand(issueListCmd)
	issueListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee")
	issueListCmd.Flags().StringSliceP("label", "l", nil, "Filter by labels")
	issueListCmd.Flags().StringP("state", "s", "open", "Filter by state: {open|closed|all}")
	issueListCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch")
	issueListCmd.Flags().StringP("author", "A", "", "Filter by author")
	issueListCmd.Flags().String("mention", "", "Filter by mention")
	issueListCmd.Flags().StringP("milestone", "m", "", "Filter by milestone `name`")

	issueCmd.AddCommand(issueViewCmd)
	issueViewCmd.Flags().BoolP("web", "w", false, "Open an issue in the browser")

	issueCmd.AddCommand(issueCloseCmd)
	issueCmd.AddCommand(issueReopenCmd)
}

var issueCmd = &cobra.Command{
	Use:   "issue <command>",
	Short: "Create and view issues",
	Long:  `Work with GitHub issues`,
	Example: heredoc.Doc(`
	$ gh issue list
	$ gh issue create --label bug
	$ gh issue view --web
	`),
	Annotations: map[string]string{
		"IsCore": "true",
		"help:arguments": `An issue can be supplied as argument in any of the following formats:
- by number, e.g. "123"; or
- by URL, e.g. "https://github.com/OWNER/REPO/issues/123".`},
}