@@ -386,20 +386,16 @@ var Confirm = func(prompt string, result *bool) error {
386386
387387func repoView (cmd * cobra.Command , args []string ) error {
388388 ctx := contextForCommand (cmd )
389-
390- var openURL string
391389 var toView ghrepo.Interface
392390 if len (args ) == 0 {
393- baseRepo , err := determineBaseRepo (cmd , ctx )
391+ var err error
392+ toView , err = determineBaseRepo (cmd , ctx )
394393 if err != nil {
395394 return err
396395 }
397- openURL = fmt .Sprintf ("https://github.com/%s" , ghrepo .FullName (baseRepo ))
398- toView = baseRepo
399396 } else {
400397 repoArg := args [0 ]
401398 if isURL (repoArg ) {
402- openURL = repoArg
403399 parsedURL , err := url .Parse (repoArg )
404400 if err != nil {
405401 return fmt .Errorf ("did not understand argument: %w" , err )
@@ -411,23 +407,19 @@ func repoView(cmd *cobra.Command, args []string) error {
411407 }
412408 } else {
413409 toView = ghrepo .FromFullName (repoArg )
414- openURL = fmt .Sprintf ("https://github.com/%s" , repoArg )
415410 }
416411 }
417412
418413 apiClient , err := apiClientForContext (ctx )
419-
420414 if err != nil {
421415 return err
422416 }
423-
424- _ , err_message := api .GitHubRepo (apiClient , toView )
425- if err_message != nil {
426- return err_message
417+ _ , err = api .GitHubRepo (apiClient , toView )
418+ if err != nil {
419+ return err
427420 }
428421
422+ openURL := fmt .Sprintf ("https://github.com/%s" , ghrepo .FullName (toView ))
429423 fmt .Fprintf (cmd .ErrOrStderr (), "Opening %s in your browser.\n " , displayURL (openURL ))
430424 return utils .OpenInBrowser (openURL )
431-
432-
433425}
0 commit comments