clionfig
interactive json config file generator and reader written in go
how it works
- Prompts user to enter config data you need to save in config system directory.
- When the config file exists, read the config data to
map[string]string.
how to use
- Make a
map[string]string.
- Keys are your config options names.
- Values will be printed when user is asked to enter some necessary data.
- Set it to
"" to skip the prompt.
"\_err":"text" gets printed when user doesn't enter data. Don't add it if config is optional.
- Call
clionfig.Open(string, *map[string]string) with your desired path and filename.
example code
package main
import "github.com/damemay/clionfig"
func main() {
config := map[string]string{
"key":"Copy-paste your key",
"username":"Enter your username",
"e-mail":"Enter your e-mail",
"something_i_want_to_set_later_myself":"",
"_err":"Please enter something",
}
if err := clionfig.Open("example/my.conf", &config); err != nil {
panic(err)
}
// do things with your mapped data ...
}