clionfig

package module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 8 Imported by: 0

README

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

  1. Make a map[string]string.
  2. Keys are your config options names.
  3. 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.
  4. 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 ...
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(path string, prompts *map[string]string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL