From daf27af34aa7247f47bd86b7eb682ed7cec4b0a0 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 19 May 2021 19:17:14 -0700 Subject: [PATCH] only accepts 1 arg at most --- pkg/cmd/browse/browse.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/browse/browse.go b/pkg/cmd/browse/browse.go index f6944c88b..5fdfd1065 100644 --- a/pkg/cmd/browse/browse.go +++ b/pkg/cmd/browse/browse.go @@ -14,8 +14,9 @@ func NewCmdBrowse(f *cmdutil.Factory) *cobra.Command { Long: "Work with GitHub in the browser", // displays when you are on the help page of this command Short: "Open GitHub in the browser", // displays in the gh root help Use: "browse", // necessary!!! This is the cmd that gets passed on the prompt - Run: func(cmd *cobra.Command, args []string) { // run gets rid of the usage / runs function - openInBrowser(cmd, f) + Args: cobra.RangeArgs(0, 1), // make sure only one arg at most is passed + Run: func(cmd *cobra.Command, args []string) { + openInBrowser(cmd, f) // run gets rid of the usage / runs function }, } @@ -23,6 +24,7 @@ func NewCmdBrowse(f *cmdutil.Factory) *cobra.Command { } func openInBrowser(cmd *cobra.Command, f *cmdutil.Factory) { + // args := cmd.Args baseRepo, err := f.BaseRepo() if err != nil { fmt.Println("error")