add --debug option for client

master
Jordan Orelli 10 years ago
parent 0e755398dd
commit 036a41acdf

@ -197,6 +197,9 @@ func (c *Client) sendRequest(r request) (chan Envelope, error) {
} }
func (c *Client) info(template string, args ...interface{}) { func (c *Client) info(template string, args ...interface{}) {
if !options.debug {
return
}
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()

@ -21,6 +21,7 @@ var options struct {
key string key string
publicKey string publicKey string
nick string nick string
debug bool
} }
func exit(status int, template string, args ...interface{}) { func exit(status int, template string, args ...interface{}) {
@ -69,4 +70,5 @@ func init() {
flag.StringVar(&options.key, "key", "whisper_key", "rsa key to use") flag.StringVar(&options.key, "key", "whisper_key", "rsa key to use")
flag.StringVar(&options.publicKey, "public-key", "", "public rsa key to use") flag.StringVar(&options.publicKey, "public-key", "", "public rsa key to use")
flag.StringVar(&options.nick, "nick", "", "nick to use in chat") flag.StringVar(&options.nick, "nick", "", "nick to use in chat")
flag.BoolVar(&options.debug, "debug", false, "include debug messages")
} }

Loading…
Cancel
Save