Settingo now allows you to define and pass structs with annotated fields directly, making your configuration cleaner and simpler. With IDE integration from code completion
import (
"fmt"
"github.com/Attumm/settingo/settingo"
"log"
)
type Config struct {
Filename string `settingo:"Path of the filename"`
Storage string `settingo:"Storage type"`
Convert bool `settingo:"Convert mode, will convert data into Convert Storage type"`
ConvertStorage string `settingo:"bytes"`
}
func main() {
config := &Config{
Filename: "~/Downloads/archive/data",
Storage: "csv",
Convert: true,
ConvertStorage: "bytes",
}
settingo.ParseTo(config)
fmt.Println(config.Filename)
fmt.Println(config.Storage)
fmt.Println(config.Convert)
fmt.Println(config.ConvertStorage)
}
./foobar --help
Usage of ./go_quote:
-CONVERT string
Convert mode, will convert data into Convert Storage type (default "true")
-CONVERTSTORAGE string
bytes (default "bytes")
-FILENAME string
Path of the filename (default "~/Downloads/archive/data.csv")
-STORAGE string
Storage type (default "csv")