Giter Club home page Giter Club logo

conf's Introduction

conf

Really, really simple key=val configuration file parser for Go

Example

Each parameter is in the form key=val. Keys are strings (can have embedded whitespace) and values are either strings or unsigned integers.

Comments must be on lines by themselves and start with #

# Moon Landing Configuration File

program.name=Apollo
sequence=11
commander=N. A. Armstrong
lm pilot=E. E. Aldrin
cm pilot=M. Collins
year=1969
capcom=C. M. Duke

API

Read the config file with ReadConfigFile, extract the values with GetString, GetUint and check for any extra values (often typos) with CheckUnread.

// ReadConfigFile reads an entire config file and return a Config
// structure that can be used to extract single values.
func ReadConfigFile(file string) (c *Config, err error)

// GetString reads a string value from the parsed config file and
// return it (or if it is missing then return the default value passed
// in d)
func (c *Config) GetString(k string, d string) (v string)

// GetUint reads an unsigned integer from the parsed config file and
// return it (or if it is missing then return the default value passed
// in d)
func (c *Config) GetUint(k string, d uint) (v uint)

// CheckUnread checks to see if any of the parameters in the file
// have not been read and returns a string containing those that have
// not been read.
func (c *Config) CheckUnread() (s string)

conf's People

Contributors

jgrahamc avatar dchest avatar

Stargazers

Christian Bagley avatar astrolemonade avatar Arda Acar avatar Daniel Tanev avatar ℳℋℳⅅ avatar idoxtreme avatar w4v3 avatar Cédric Clément avatar  avatar lotus-king avatar rob boll avatar Navneet Kumar avatar Mathieu M-Gosselin avatar Joe Roberts avatar Bo avatar KS Chan avatar metakeule avatar Pawel Cyrta avatar  avatar Pantelis Koukousoulas avatar Carlos Alberto Costa Beppler avatar Mohd Rozi avatar Pedro Saraiva avatar Alvaro avatar Adam DeConinck avatar Benjamin Ruston avatar Lawrence Goldstien avatar Jesse Nelson avatar Carl Huang avatar Mariusz Pietrzyk avatar Gus Becciu avatar Tommy Bishop avatar James O'Gorman avatar Théo Crevon avatar Damian Gryski avatar Tatsuhiko Kubo avatar

Watchers

Austin McKinley avatar Dane avatar  avatar Jeremy Teale avatar David Schlesinger avatar James Cloos avatar Carl Huang avatar Nick Sullivan avatar Arun Sathiya avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.