Added flag lib for parsing env + flag + file
This commit is contained in:
parent
289684b0f1
commit
55bc749f89
16
main.go
16
main.go
@ -2,17 +2,21 @@ package main
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
import "github.com/go-irc/irc"
|
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() {
|
func main() {
|
||||||
var pass string
|
pass := flag.String("pass", "", "password")
|
||||||
flag.String(pass)
|
flag.Parse()
|
||||||
config := irc.ClientConfig {
|
config := irc.ClientConfig {
|
||||||
Nick: "wat",
|
Nick: "wat",
|
||||||
Pass: pass,
|
Pass: *pass,
|
||||||
User: "wat",
|
User: "wat",
|
||||||
Name: "wat",
|
Name: "wat",
|
||||||
Handler: testHandler
|
Handler: irc.HandlerFunc(testHandler),
|
||||||
}
|
}
|
||||||
fmt.Println("Hello world")
|
fmt.Printf("Hello world %+v\n", config)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user