Skip to content

Commit

Permalink
issue/pr comment completion
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Feb 23, 2021
1 parent 2783a80 commit d09d4c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/cmd/issue/comment/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
issueShared "github.com/cli/cli/pkg/cmd/issue/shared"
prShared "github.com/cli/cli/pkg/cmd/pr/shared"
"github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/cmdutil/action"
"github.com/cli/cli/utils"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -46,6 +48,12 @@ func NewCmdComment(f *cmdutil.Factory, runF func(*prShared.CommentableOptions) e
cmd.Flags().BoolP("editor", "e", false, "Add body using editor")
cmd.Flags().BoolP("web", "w", false, "Add body in browser")

cmdutil.DeferCompletion(func() {
carapace.Gen(cmd).PositionalCompletion(
action.ActionIssues(cmd, action.IssueOpts{Open: true}),
)
})

return cmd
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/cmd/pr/comment/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (
"github.com/cli/cli/internal/ghrepo"
"github.com/cli/cli/pkg/cmd/pr/shared"
"github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/cmdutil/action"
"github.com/cli/cli/utils"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -53,6 +55,12 @@ func NewCmdComment(f *cmdutil.Factory, runF func(*shared.CommentableOptions) err
cmd.Flags().BoolP("editor", "e", false, "Add body using editor")
cmd.Flags().BoolP("web", "w", false, "Add body in browser")

cmdutil.DeferCompletion(func() {
carapace.Gen(cmd).PositionalCompletion(
action.ActionPullRequests(cmd, action.PullRequestOpts{Open: true}),
)
})

return cmd
}

Expand Down

0 comments on commit d09d4c9

Please sign in to comment.