Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skx/headerfile
Parse files with simple key:value headers, easily.
https://github.com/skx/headerfile
golang header library utility
Last synced: 18 days ago
JSON representation
Parse files with simple key:value headers, easily.
- Host: GitHub
- URL: https://github.com/skx/headerfile
- Owner: skx
- License: gpl-2.0
- Created: 2019-10-08T06:00:51.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-08T15:01:05.000Z (about 5 years ago)
- Last Synced: 2024-10-02T10:12:27.355Z (about 1 month ago)
- Topics: golang, header, library, utility
- Language: Go
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![GoDoc](https://godoc.org/github.com/skx/headerfile?status.svg)](http://godoc.org/github.com/skx/headerfile)
[![Go Report Card](https://goreportcard.com/badge/github.com/skx/headerfile)](https://goreportcard.com/report/github.com/skx/headerfile)
[![license](https://img.shields.io/github/license/skx/headerfile.svg)](https://github.com/skx/headerfile/blob/master/LICENSE)
[![Release](https://img.shields.io/github/release/skx/headerfile.svg)](https://github.com/skx/headerfile/releases/latest)# headerfile
This is a simple package which allows you to process files which consist of a key-value header, and then content.
## Use Case
The initial-use case was for a simple blog-compiler, which consumes a series of files containing posts. As you might expect each post has some associated meta-data, such as a title, a set of tags, etc.
This library allows you to read the two parts of this file seperately, and cleanly:
```
Subject: This is my post
Date: 10th March 1980
Tags: foo, bar, bazThis is my blog post ..
```Once parsed you can receive :
* The body of the post.
* A map containing the (string) keys and values present in the header.
* The header-values may be separated by either `:` or `=`.## Github Setup
This repository is configured to run tests upon every commit, and when
pull-requests are created/updated. The testing is carried out via
[.github/run-tests.sh](.github/run-tests.sh) which is used by the
[github-action-tester](https://github.com/skx/github-action-tester) action.If test-coverage drops beneath 100% this is a bug. The package is simple
enough that this should not be an undue burdon.Steve
--