From cb3792051a0b1efe2d6c7c1656411db3999b43cc Mon Sep 17 00:00:00 2001 From: ttran112 Date: Wed, 26 May 2021 19:27:07 -0700 Subject: [PATCH] fix minor error and add branchName for addArgs, addCombine --- pkg/cmd/browse/browse.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/cmd/browse/browse.go b/pkg/cmd/browse/browse.go index 31fc6fc05..9ef3202bf 100644 --- a/pkg/cmd/browse/browse.go +++ b/pkg/cmd/browse/browse.go @@ -114,6 +114,11 @@ func openInBrowser(cmd *cobra.Command, opts *BrowseOptions) { response, repoUrl = addCombined(opts, repoUrl, branchName) } + if response != exitSuccess { + printExit(response, cmd, opts, repoUrl) // print success + return + } + response = getHttpResponse(opts, repoUrl) if response == exitSuccess { // test the connection to see if the url is valid opts.Browser.Browse(repoUrl) // otherwise open repo @@ -138,11 +143,6 @@ func addCombined(opts *BrowseOptions, url string, branchName string) (exitCode, } return exitError, "" - // if isNumber(opts.AdditionalArg) && opts.LineFlag { // if second arg is a number it should be a line number - // return "/" + opts.SelectorArg + "#L" + opts.AdditionalArg - // } - // return "/tree/" + opts.AdditionalArg + "/" + opts.SelectorArg - // } } func addFlags(opts *BrowseOptions, url string) (exitCode, string) { @@ -157,6 +157,12 @@ func addFlags(opts *BrowseOptions, url string) (exitCode, string) { } func addArgs(opts *BrowseOptions, url string, branchName string) (exitCode, string) { + + if opts.AdditionalArg != "" { + // fmt.Println("test secodn argument") + return exitError, "" + } + if isNumber(opts.SelectorArg) { return exitSuccess, url + "/issues/" + opts.SelectorArg }