Skip to content

Commit d594c5e

Browse files
BagToadCopilotbabakks
authored
docs: add examples to gh issue close help text (cli#12830)
Add examples for closing issues, closing with a comment, closing as duplicate, and closing with a reason. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Babak K. Shandiz <babakks@github.com>
1 parent 38c9975 commit d594c5e

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

pkg/cmd/issue/close/close.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"net/http"
66
"time"
77

8+
"github.com/MakeNowJust/heredoc"
89
"github.com/cli/cli/v2/api"
910
fd "github.com/cli/cli/v2/internal/featuredetection"
1011
"github.com/cli/cli/v2/internal/ghrepo"
@@ -38,7 +39,20 @@ func NewCmdClose(f *cmdutil.Factory, runF func(*CloseOptions) error) *cobra.Comm
3839
cmd := &cobra.Command{
3940
Use: "close {<number> | <url>}",
4041
Short: "Close issue",
41-
Args: cobra.ExactArgs(1),
42+
Example: heredoc.Doc(`
43+
# Close issue
44+
$ gh issue close 123
45+
46+
# Close issue and add a closing comment
47+
$ gh issue close 123 --comment "Closing this issue"
48+
49+
# Close issue as a duplicate of issue #456
50+
$ gh issue close 123 --duplicate-of 456
51+
52+
# Close issue as not planned
53+
$ gh issue close 123 --reason "not planned"
54+
`),
55+
Args: cobra.ExactArgs(1),
4256
RunE: func(cmd *cobra.Command, args []string) error {
4357
issueNumber, baseRepo, err := shared.ParseIssueFromArg(args[0])
4458
if err != nil {

0 commit comments

Comments
 (0)