All Projects → muja → goconfig

muja / goconfig

Licence: other
.gitconfig syntax parser

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to goconfig

profig
Powerful configuration management for Scala (JSON, properties, command-line arguments, and environment variables)
Stars: ✭ 25 (+66.67%)
Mutual labels:  config, configuration, properties
eRCaGuy dotfiles
.bashrc file, terminal prompt that shows current git branch, Arduino setup, Eclipse setup, git diff with line numbers, helpful scripts, improved Linux productivity, etc.
Stars: ✭ 84 (+460%)
Mutual labels:  config, configuration, gitconfig
Konf
A type-safe cascading configuration library for Kotlin/Java/Android, supporting most configuration formats
Stars: ✭ 225 (+1400%)
Mutual labels:  config, configuration, properties
config-parser
A slim, fully managed C# library for reading/writing .ini, .conf, .cfg etc configuration files.
Stars: ✭ 67 (+346.67%)
Mutual labels:  config, configuration, cfg
javaproperties
Python library for reading & writing Java .properties files
Stars: ✭ 20 (+33.33%)
Mutual labels:  config, configuration, properties
spdlog setup
spdlog setup initialization via file configuration for convenience.
Stars: ✭ 68 (+353.33%)
Mutual labels:  config, configuration
neovim-config
Modern NeoVim config for IDE-like development
Stars: ✭ 89 (+493.33%)
Mutual labels:  config, configuration
ha-config-ataraxis
My Home Assistant Configs. If you like what you see, please ⭐️my repo. It would encourage me a lot 🤘
Stars: ✭ 146 (+873.33%)
Mutual labels:  config, configuration
goodconf
Transparently load variables from environment or JSON/YAML file.
Stars: ✭ 80 (+433.33%)
Mutual labels:  config, configuration
props
config source library for golang, support properties/yaml/ini file、zookeeper\consul\etcd k/v k/props
Stars: ✭ 57 (+280%)
Mutual labels:  config, properties
eslint-define-config
Provide a defineConfig function for .eslintrc.js files
Stars: ✭ 61 (+306.67%)
Mutual labels:  config, configuration
Charles-Proxy-Mobile-Guide
The mobile hackers' guide to Charles Proxy 👍
Stars: ✭ 105 (+600%)
Mutual labels:  config, configuration
go-contrib
Helper for Log configuration, Mixin for properties with fangs
Stars: ✭ 20 (+33.33%)
Mutual labels:  configuration, properties
parse it
A python library for parsing multiple types of config files, envvars & command line arguments that takes the headache out of setting app configurations.
Stars: ✭ 86 (+473.33%)
Mutual labels:  config, configuration
yaask
Make your yaml configurable with interactive configurations!
Stars: ✭ 15 (+0%)
Mutual labels:  config, configuration
environment
🌳 Environment variable configuration for Node.js made easy.
Stars: ✭ 12 (-20%)
Mutual labels:  config, configuration
dotfiles
My personal app/env configs and dotfiles.
Stars: ✭ 27 (+80%)
Mutual labels:  config, configuration
easy-props
The simple, stupid properties library for Java
Stars: ✭ 76 (+406.67%)
Mutual labels:  configuration, properties
Machfiles
The dotfiles you see in all my videos
Stars: ✭ 347 (+2213.33%)
Mutual labels:  config, configuration
tomlj
A Java parser for Tom's Obvious, Minimal Language (TOML).
Stars: ✭ 72 (+380%)
Mutual labels:  config, configuration

goconfig

Travis Build Status

Table of contents

  1. Introduction
  2. Usage
  3. Contributing
  4. Reporting bugs

1. Introduction

This project parses config files that have the same syntax as gitconfig files. It is a minimal parser, and maybe a writer sometime in the future. It has no knowledge of git-specific keys and as such, does not provide any convenience methods like config.GetUserName(). For these, look into go-gitconfig

Most of the code was copied and translated to Go from git/config.c

2. Usage

Currently, there is only one function: Parse.

import "os/user"
import "path/filepath"
import "io/ioutil"
import "github.com/muja/goconfig"

user, _ := user.Current()
// don't forget to handle error!
gitconfig := filepath.Join(user.HomeDir, ".gitconfig")
bytes, _ := ioutil.ReadFile(gitconfig)

config, lineno, err := goconfig.Parse(bytes)
if err != nil {
  // Note: config is non-nil and contains successfully parsed values
  log.Fatalf("Error on line %d: %v.\n", err)
}
fmt.Println(config["user.name"])
fmt.Println(config["user.email"])

3. Contributing

Contributions are welcome! Fork -> Push -> Pull request.

4. Bug report / suggestions

Just create an issue! I will try to reply as soon as possible.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].