Skip to content

nishanths/go-hgconfig

Repository files navigation

Read Mercurial configuration (hg config) values in Go.

Useful for finding out config values such as ui.username.

wercker status GoDoc

Install

go get gopkg.in/nishanths/go-hgconfig.v1

Import it as:

import gopkg.in/nishanths/go-hgconfig.v1

and refer to it as hgconfig.

Test

Tests can be found in go_hgconfig_test.go. To run tests, install ginkgo and gomega, then run:

go test

Usage

package main

import (
    "fmt"
    "gopkg.in/nishanths/go-hgconfig.v1"
)

func main() {
    value, _ := hgconfig.Get("ui.username")
    fmt.Println(value)
}

An example can also be found at example/main.go, and can be run using go run example/main.go.

Functions

Get

Get lets you read a hg config value by name.

value, _ := hgconfig.Get("merge-tools.editmerge.premerge")

Username

Username is a convenience function for getting the config value for ui.username. This is the same as calling hgconfig.Get("ui.username").

username, _ := hgconfig.Username()

Contributing

Pull requests for new features are welcome!

Also See

License

go-hgconfig is licensed under the MIT License

About

Read Mercurial configuration (hg config) values

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages