@@ -20,17 +20,16 @@ var repoCmd = &cobra.Command{
2020 Long : `Work with GitHub repositories.
2121
2222A repository can be supplied as an argument in any of the following formats:
23- - by owner/repo, e.g. "cli/cli "
24- - by URL, e.g. "https://github.com/cli/cli "` ,
23+ - "OWNER/REPO "
24+ - by URL, e.g. "https://github.com/OWNER/REPO "` ,
2525}
2626
2727var repoViewCmd = & cobra.Command {
28- Use : "view [{<owner/ repo> | <url>} ]" ,
28+ Use : "view [< repo>]" ,
2929 Short : "View a repository in the browser" ,
30- Long : `View a repository specified by the argument in the browser.
30+ Long : `View a GitHub repository in the browser.
3131
32- Without an argument, the repository that belongs to the current
33- branch is opened.` ,
32+ With no argument, the repository for the current directory is opened.` ,
3433 RunE : repoView ,
3534}
3635
@@ -45,10 +44,11 @@ func repoView(cmd *cobra.Command, args []string) error {
4544 }
4645 openURL = fmt .Sprintf ("https://github.com/%s" , ghrepo .FullName (* baseRepo ))
4746 } else {
48- if strings .HasPrefix (args [0 ], "http" ) {
49- openURL = args [0 ]
47+ repoArg := args [0 ]
48+ if strings .HasPrefix (repoArg , "http:/" ) || strings .HasPrefix (repoArg , "https:/" ) {
49+ openURL = repoArg
5050 } else {
51- openURL = fmt .Sprintf ("https://github.com/%s" , args [ 0 ] )
51+ openURL = fmt .Sprintf ("https://github.com/%s" , repoArg )
5252 }
5353 }
5454
0 commit comments