cfgFlags

package module
v0.0.0-...-6e08018 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2015 License: MIT Imports: 6 Imported by: 0

README

cfg_flags

Go package to use an INI configuration file alongside the "flag" package.

Inspired by iniflags, cfg_flags goal is to be simple, without any advanced features like configuration reloading. It is only meant to integrate an INI file with golang's flag package, nothing more.

Usage

Just replace flag.Parse() by cfg_flags.Parse() in your code. cfg_flags.Parse() will return any error that occurs while parsing the configuration file, it is up to you to handle them.

Code sample:

if err := cfg_flags.Parse(); err != nil {
    flag.Usage()
    log.Fatal(err)
}

In order to specify the configuration file to use, you need to set the -config flag, e.g. my_app -config my_config.ini.

Documentation

Overview

Package cfgFlags implements an "hybrid" configuration management, using an INI configuration file alongside the "flag" package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse() error

Parse is the equivalent of flag.Parse() except that it also retrieve configuration values fron an INI file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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