Browse Source

Merge pull request #73 from frankstratton/master

allow you to add custom views
inconshreveable 11 years ago
parent
commit
e8856fff16
3 changed files with 7 additions and 7 deletions
  1. 1 1
      src/ngrok/client/cli.go
  2. 5 5
      src/ngrok/client/controller.go
  3. 1 1
      src/ngrok/client/main.go

+ 1 - 1
src/ngrok/client/cli.go

@@ -44,7 +44,7 @@ type Options struct {
 	args      []string
 }
 
-func parseArgs() (opts *Options, err error) {
+func ParseArgs() (opts *Options, err error) {
 	flag.Usage = func() {
 		fmt.Fprintf(os.Stderr, usage1, os.Args[0])
 		flag.PrintDefaults()

+ 5 - 5
src/ngrok/client/controller.go

@@ -122,7 +122,7 @@ func (ctl *Controller) doShutdown() {
 	wg.Wait()
 }
 
-func (ctl *Controller) addView(v mvc.View) {
+func (ctl *Controller) AddView(v mvc.View) {
 	ctl.views = append(ctl.views, v)
 }
 
@@ -143,25 +143,25 @@ func (ctl *Controller) Run(config *Configuration) {
 	var webView *web.WebView
 	if config.InspectAddr != "disabled" {
 		webView = web.NewWebView(ctl, config.InspectAddr)
-		ctl.addView(webView)
+		ctl.AddView(webView)
 	}
 
 	// init term ui
 	var termView *term.TermView
 	if config.LogTo != "stdout" {
 		termView = term.NewTermView(ctl)
-		ctl.addView(termView)
+		ctl.AddView(termView)
 	}
 
 	for _, protocol := range model.GetProtocols() {
 		switch p := protocol.(type) {
 		case *proto.Http:
 			if termView != nil {
-				ctl.addView(termView.NewHttpView(p))
+				ctl.AddView(termView.NewHttpView(p))
 			}
 
 			if webView != nil {
-				ctl.addView(webView.NewHttpView(p))
+				ctl.AddView(webView.NewHttpView(p))
 			}
 		default:
 		}

+ 1 - 1
src/ngrok/client/main.go

@@ -10,7 +10,7 @@ import (
 
 func Main() {
 	// parse options
-	opts, err := parseArgs()
+	opts, err := ParseArgs()
 	if err != nil {
 		fmt.Println(err)
 		os.Exit(1)