From 7bebef3097eb4bc24a472a70f2d833c85d62cbdc Mon Sep 17 00:00:00 2001 From: "yakumo.izuru" Date: Mon, 1 Apr 2024 18:53:04 +0000 Subject: [PATCH] Something will be done eventually Signed-off-by: Izuru Yakumo git-svn-id: https://svn.yakumo.dev/yakumo.izuru/chen/trunk@39 32723744-9b23-0b4a-b1da-9b2e968f9461 --- cmd/chen/main.go | 34 ++++++++++++++++++++++++++++++++++ go.mod | 7 +++++++ go.sum | 7 +++++++ 3 files changed, 48 insertions(+) create mode 100644 cmd/chen/main.go create mode 100644 go.mod create mode 100644 go.sum diff --git a/cmd/chen/main.go b/cmd/chen/main.go new file mode 100644 index 0000000..b8826e5 --- /dev/null +++ b/cmd/chen/main.go @@ -0,0 +1,34 @@ +package main + +import ( + "gopkg.in/ini.v1" +) + +var chen struct { + jid string + password string + prefix string + nick string + autojoin string +} + +func readConf(file string) error { + cfg, err := ini.Load(file) + + if err != nil { + return err + } + + chen.jid = cfg.Section("chen").Key("jid").String() + chen.password = cfg.Section("chen").Key("password").String() + chen.prefix = cfg.Section("chen").Key("prefix").String() + chen.nick = cfg.Section("chen").Key("nick").String() + chen.autojoin = cfg.Section("chen").Key("autojoin").String() + + return nil +} + +func main() { + readConf(chen.ini) + // Do whatever here +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..095e444 --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module git.chaotic.ninja/yakumo_izuru/chen + +go 1.20 + +require gopkg.in/ini.v1 v1.67.0 + +require github.com/stretchr/testify v1.9.0 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..eb1ea6f --- /dev/null +++ b/go.sum @@ -0,0 +1,7 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=