cleaned up the code base, opening the web browser is now matching the style of th e repo. We also made a dialogue in our helpful-resources.txt about what we will be doing next. Big things to comegit add .

This commit is contained in:
Ben 2021-05-15 21:40:43 -07:00
parent 68ce66801b
commit d656a9077b
2 changed files with 33 additions and 14 deletions

View file

@ -1,11 +1,7 @@
package browse
import (
"fmt"
"os"
"github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/iostreams"
"github.com/spf13/cobra"
)
@ -15,20 +11,31 @@ func NewCmdBrowse(f *cmdutil.Factory) *cobra.Command {
Long: "Hello world", // 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
openInBrowser()
Run: func(cmd *cobra.Command, args []string) { // run gets rid of the usage / runs function
openInBrowser(cmd, f)
},
}
cmdutil.EnableRepoOverride(cmd, f)
cmdutil.EnableRepoOverride(cmd, f) // Q: what does this do???
return cmd
}
func openInBrowser() {
fmt.Println("");
IO,_,_,_ := iostreams.Test() // why is this called test? is it to be used for the final product?
browser := cmdutil.NewBrowser(os.Getenv("BROWSER"), IO.Out, IO.ErrOut)
browser.Browse("www.github.com")
}
func openInBrowser(cmd *cobra.Command, f *cmdutil.Factory) {
const root = "www.github.com"
f.Browser.Browse(root)
}
/*
Moving forward, since we can open in the browser we need to discuss logic of arguments
This includes:
1. Open the repo in browser with just "gh browse"
2. Make the help instruction display while opening using IOStreams
3. Find out how "cmd" stores args within, to be parsed
4. Make a table of all the possible inputs that are valid
5. Possibly work on error handling
6. Clarify table with client before moving forward with args
*/

View file

@ -8,3 +8,15 @@ https://github.com/cli/cli/blob/trunk/docs/project-layout.md
Our working fork
https://github.com/bchadwic/cli/tree/trunk
https://umarcor.github.io/cobra/#example
5/15/21
Moving forward, since we can open in the browser we need to discuss logic of arguments
This includes:
1. Open the repo in browser with just "gh browse"
2. Make the help instruction display while opening using IOStreams
3. Find out how "cmd" stores args within, to be parsed
4. Make a table of all the possible inputs that are valid
5. Possibly work on error handling
6. Clarify table with client before moving forward with args