Goconfig
.gitconfig syntax parser
Install / Use
/learn @muja/GoconfigREADME
goconfig
Table of contents
- Introduction
- Usage
- Contributing
- 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.
Related Skills
node-connect
353.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
353.3kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
111.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
353.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
