Skip to content

Commit

Permalink
feat: expose verbose flag to package
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan committed Nov 4, 2021
1 parent 4dd8c79 commit 42e5ed3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/vproxy/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"strings"

"github.com/jittering/vproxy"
"github.com/urfave/cli/v2"
)

Expand Down Expand Up @@ -55,6 +56,14 @@ vproxy connect hello.local:8888 -- vproxy hello
cli.ShowAppHelpAndExit(c, 1)
},

Before: func(c *cli.Context) error {
vproxy.VERBOSE = c.Bool("verbose")
if vproxy.VERBOSE {
fmt.Println("[*] enabled verbose output")
}
return nil
},

Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Expand Down
3 changes: 3 additions & 0 deletions daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import (
"github.com/mitchellh/go-homedir"
)

// Controls whether verbose messages should be printed
var VERBOSE = false

// PONG server identifier
const PONG = "hello from vproxy"

Expand Down

0 comments on commit 42e5ed3

Please sign in to comment.