Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thediveo/osrelease
A slightly pedantic os-release parser.
https://github.com/thediveo/osrelease
Last synced: about 1 month ago
JSON representation
A slightly pedantic os-release parser.
- Host: GitHub
- URL: https://github.com/thediveo/osrelease
- Owner: thediveo
- License: apache-2.0
- Created: 2021-10-22T18:00:27.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-27T19:18:17.000Z (about 1 year ago)
- Last Synced: 2024-05-16T14:01:50.825Z (6 months ago)
- Language: Go
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# A Pedantic `os-release` Parser
[![License](https://img.shields.io/github/license/thediveo/osrelease)](https://img.shields.io/github/license/thediveo/osrelease)
![build and test](https://github.com/thediveo/osrelease/workflows/build%20and%20test/badge.svg?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/thediveo/osrelease)](https://goreportcard.com/report/github.com/thediveo/osrelease)
![Coverage](https://img.shields.io/badge/Coverage-100.0%25-brightgreen)`osrelease` is a Go module implementing a slightly pedantic parser for the
os-release file format, as specified in
[os-release(5)](https://www.freedesktop.org/software/systemd/man/os-release.html).
This implementation actually _parses_ quoted assignment values for escape
sequences in _correct sequence_, instead of simply doing blind
search-and-replaces (which can result in unexpected results).Oh, and this module has _tests_.
There's a reason why we call it the "_pedantic_" parser after all.
## Usage
Simply get the OS identification variables using `osrelease.New()`. That's all.
```go
package mainimport "github.com/thediveo/osrelease"
func main() {
vars := osrelease.New()
for name, value := range vars {
println(name, "=", value)
}
}
```## Contributing
Please see [CONTRIBUTING.md](CONTRIBUTING.md).
## Copyright and License
`osrelease` is Copyright 2021-23 Harald Albrecht, and licensed under the Apache
License, Version 2.0.