Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erikkalkoken/tomlq
https://github.com/erikkalkoken/tomlq
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/erikkalkoken/tomlq
- Owner: ErikKalkoken
- License: mit
- Created: 2024-07-28T22:16:16.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-01T11:17:12.000Z (3 months ago)
- Last Synced: 2024-08-01T12:52:25.960Z (3 months ago)
- Language: Go
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tomlq
Print a value from a TOML file.
[![GitHub Release](https://img.shields.io/github/v/release/ErikKalkoken/tomlq)](https://github.com/ErikKalkoken/tomlq)
[![CI/CD](https://github.com/ErikKalkoken/tomlq/actions/workflows/go.yml/badge.svg)](https://github.com/ErikKalkoken/tomlq/actions/workflows/go.yml)
[![GitHub License](https://img.shields.io/github/license/ErikKalkoken/tomlq)](https://github.com/ErikKalkoken/tomlq)## Description
tomlq is a small command line tool that can print a value from a TOML file. It's main purpose is to make it possible to use values from a TOML file in a shell script.
The found value is printed to stdout. Date values are formatted as RFC3339.
tomlq will exit with a non-zero value if it encounters an error (e.g. value not found) and print an error message to stderr. We recommend enabling the "strict error" mode in shell scripts to ensure those errors are handled:
```sh
set -e
```## Example
Let's say we have a TOML file with the name `config.toml`:
```toml
name="Charlie"
```Then we can use tomlq to read and assign that value to a variable in a shell script.
```bash
name=$(tomlq -k name config.toml)
```or
```bourne
name=`tomlq -k name config.toml`
```## Usage
To get the complete usage documentation run the following:
```sh
tomlq -h
```