X Tutup
Skip to content

Commit 1a9704d

Browse files
author
ttran112
committed
fix the route
1 parent 0174dbc commit 1a9704d

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

pkg/cmd/browse/browse.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ type BrowseOptions struct {
3131
WikiFlag bool
3232
SettingsFlag bool
3333
BranchFlag bool
34-
//LineFlag bool
3534
}
3635

3736
type exitCode int
@@ -139,7 +138,6 @@ func openInBrowser(cmd *cobra.Command, opts *BrowseOptions) error {
139138
}
140139

141140
return printExit(response, cmd, opts, repoUrl)
142-
143141
}
144142

145143
func addCombined(opts *BrowseOptions, url string, branchName string) (exitCode, string) {
@@ -158,7 +156,6 @@ func addCombined(opts *BrowseOptions, url string, branchName string) (exitCode,
158156
}
159157

160158
return exitUrlSuccess, url + "/tree/" + opts.AdditionalArg + "/" + arr[0]
161-
162159
}
163160

164161
func addFlag(opts *BrowseOptions, url string) (exitCode, string) {
@@ -169,7 +166,7 @@ func addFlag(opts *BrowseOptions, url string) (exitCode, string) {
169166
} else if opts.WikiFlag {
170167
return exitUrlSuccess, url + "/wiki"
171168
}
172-
return exitExpectedArg, "" // Flag is a branch and needs an argument
169+
return exitExpectedArg, ""
173170
}
174171

175172
func addArg(opts *BrowseOptions, url string, branchName string) (exitCode, string) {
@@ -204,10 +201,8 @@ func printExit(exit exitCode, cmd *cobra.Command, opts *BrowseOptions, url strin
204201
switch exit {
205202
case exitUrlSuccess:
206203
fmt.Fprintf(w, "now opening %s in browser . . .\n", cs.Bold(url))
207-
break
208204
case exitNonUrlSuccess:
209205
fmt.Fprintf(w, "now opening issue/pr in browser . . .\n")
210-
break
211206
case exitNotInRepo:
212207
return fmt.Errorf("change directory to a repository to open in browser\n%s", help)
213208
case exitTooManyFlags:

pkg/cmd/root/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) *cobra.Command {
9696
repoResolvingCmdFactory := *f
9797
repoResolvingCmdFactory.BaseRepo = resolvedBaseRepo(f)
9898

99-
cmd.AddCommand(browseCmd.NewCmdBrowse(f)) // adds to the commands Commands()
99+
cmd.AddCommand(browseCmd.NewCmdBrowse(&repoResolvingCmdFactory)) // adds to the commands Commands()
100100
cmd.AddCommand(prCmd.NewCmdPR(&repoResolvingCmdFactory))
101101
cmd.AddCommand(issueCmd.NewCmdIssue(&repoResolvingCmdFactory))
102102
cmd.AddCommand(releaseCmd.NewCmdRelease(&repoResolvingCmdFactory))

0 commit comments

Comments
 (0)
X Tutup