summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex2018-10-20 00:58:30 +0100
committeralex2018-10-20 00:59:07 +0100
commit55bc749f896c25adb57125fd168a1e3ccfc0cd48 (patch)
tree38c0576dc78f117a6d78cacec9997d7d75e8bf04
parent289684b0f117181c03e4e5ef6616d574da9a1981 (diff)
downloadwatbot-55bc749f896c25adb57125fd168a1e3ccfc0cd48.tar.gz
watbot-55bc749f896c25adb57125fd168a1e3ccfc0cd48.tar.bz2
watbot-55bc749f896c25adb57125fd168a1e3ccfc0cd48.zip
Added flag lib for parsing env + flag + file
-rw-r--r--main.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/main.go b/main.go
index 54ddf3c..e9cb530 100644
--- a/main.go
+++ b/main.go
@@ -2,17 +2,21 @@ package main
import "fmt"
import "github.com/go-irc/irc"
-import "github.com/namsral/flag"
+import flag"github.com/namsral/flag"
+
+func testHandler(c *irc.Client, m *irc.Message) {
+ fmt.Println("Client: %+v", c)
+}
func main() {
- var pass string
- flag.String(pass)
+ pass := flag.String("pass", "", "password")
+ flag.Parse()
config := irc.ClientConfig {
Nick: "wat",
- Pass: pass,
+ Pass: *pass,
User: "wat",
Name: "wat",
- Handler: testHandler
+ Handler: irc.HandlerFunc(testHandler),
}
- fmt.Println("Hello world")
+ fmt.Printf("Hello world %+v\n", config)
}