| CARVIEW |
git-config: A simple parser for Git configuration files
git-config is a simple megaparsec parser for Git configuration files.
It aims to provide the simplest API possible for parsing Git configuration files so that you can get to whatever it was you were doing.
A sample of this library in use:
import qualified Data.Text.IO as TIO
import Text.GitConfig.Parser (parseConfig)
main :: IO ()
main = do
file <- TIO.readFile ".git/config"
case parseConfig file of
Right conf ->
print conf
[Skip to Readme]
Downloads
- git-config-0.1.2.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.0, 0.1.1, 0.1.2 |
|---|---|
| Dependencies | base (>=4.7 && <5), megaparsec (>=7 && <9), text, unordered-containers [details] |
| License | BSD-3-Clause |
| Copyright | 2018 Fernando Freire |
| Author | Fernando Freire |
| Maintainer | Fernando Freire <dogonthehorizon@gmail.com> |
| Uploaded | by ffreire at 2019-11-17T00:31:16Z |
| Category | Library, Git |
| Home page | https://github.com/dogonthehorizon/git-config#readme |
| Bug tracker | https://github.com/dogonthehorizon/git-config/issues |
| Source repo | head: git clone https://github.com/dogonthehorizon/git-config |
| Distributions | |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Downloads | 2509 total (10 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2019-11-17 [all 1 reports] |
Readme for git-config-0.1.2
[back to package description]git-config
A simple parser for Git configuration files.
Getting Started
This project is built using Stack, make sure you have it installed before proceeding.
You can fire up an interactive session like so:
stack ghci
The library can be built or tested like so:
# Building
stack build
# Running tests
stack test
Usage
A Git configuration is a colletion of sections that contain mappings of keys to values.
For the sake of simplicity this is represented as [Section] where a
Section is a collection of section names and a mapping of keys to values.
We can use the parser like so:
import qualified Data.Text.IO as TIO
import Text.GitConfig.Parser (parseConfig)
main :: IO ()
main = do
file <- TIO.readFile ".git/config"
case parseConfig file of
Right conf ->
print conf
Left error ->
print error
If you'd like to do your own parsing you can import the individual combinators
from the Text.GitConfig.Parser module.