Skip to content

Commit 8fa2457

Browse files
authored
Merge pull request cli#27 from ttran112/trunk
added the message to help the user navigate github
2 parents 0f2e299 + 52e7b7c commit 8fa2457

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

pkg/cmd/browse/browse.go

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import (
66
"strconv"
77
"strings"
88

9+
"github.com/MakeNowJust/heredoc"
10+
"github.com/cli/cli/api"
911
"github.com/cli/cli/internal/ghrepo"
1012
"github.com/cli/cli/pkg/cmdutil"
1113
"github.com/cli/cli/pkg/iostreams"
1214
"github.com/spf13/cobra"
13-
14-
"github.com/cli/cli/api"
1515
)
1616

1717
type browser interface {
@@ -60,6 +60,29 @@ func NewCmdBrowse(f *cmdutil.Factory) *cobra.Command {
6060
Use: "browse", // necessary!!! This is the cmd that gets passed on the prompt
6161
Args: cobra.RangeArgs(0, 2), // make sure only one arg at most is passed
6262

63+
Example: heredoc.Doc(`
64+
$ gh browse
65+
#=> Opens repository in browser
66+
67+
$ gh browse 217
68+
#=> Opens issue or pull request 217
69+
70+
$ gh browse --settings
71+
#=> Opens repository settings in browser
72+
73+
$ gh browse src/fileName:312 --branch main
74+
#=> Opens src/fileName at line 312 in main branch
75+
`),
76+
77+
Annotations: map[string]string{
78+
"IsCore": "true",
79+
"help:arguments": heredoc.Doc(`
80+
A browse location can be supplied as an argument in any of the following formats:
81+
- by number, e.g. "123"; or
82+
- by file or branch name, e.g. "main.java" or "trunk".
83+
`),
84+
},
85+
6386
Run: func(cmd *cobra.Command, args []string) {
6487

6588
if len(args) > 1 {

0 commit comments

Comments
 (0)