read-toml-py
A small utility to read keys from TOML files.
Usage
Installation
poetry add outcome-read-toml
Usage
The utility reads the value specified by the key from the provided TOML file, and prints it to stdout.
The path parameter should be a '.' separated sequences of keys that correspond to a path in the TOML structure.
Example TOML file:
title = "My TOML file"
[info]
version = "1.0.1"
[tools.poetry]
version = "1.1.2"
files = ['a.py', 'b.py']
Read standard keys:
read-toml --path my_file.toml --key title
# "My TOML file"
read-toml --path my_file.toml --key info.version
# "1.0.1"
Read arrays:
read-toml --path my_file.toml --key tools.poetry.files
# "a.py b.py"
read-toml --path my_file.toml[0] --key tools.poetry.files
# "a.py"
You can't read non-leaf keys:
read_toml.py --path my_file.toml --key tools
# KeyError
You can check if a key exists:
read-toml --path my_file.toml --key title --check-only
# 1
read-toml --path my_file.toml --key unknown_key --check-only
# 0
Development
Remember to run ./pre-commit.sh when you clone the repository.
Release files for outcome-read-toml 2.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| outcome-read-toml-2.1.1.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| outcome_read_toml-2.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / outcome-read-toml-2.1.1.tar.gz
| Download URL | outcome-read-toml-2.1.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa5752e2b1f4b8ac6d13629210b5b79a3b3663cdfaf30175d23eb30a4b48702f
|
|
BLAKE2b-256 checksum How to use checksums |
c7716fef4cee1d60ee5c4650e7108287a7e99db07e77403eaa76439820d63e59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Darwin/19.6.0
|
Release files / outcome_read_toml-2.1.1-py3-none-any.whl
| Download URL | outcome_read_toml-2.1.1-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e90d65a1e4c6453329ee8b02b95528c2d3a8131662b91f6c2e015fdcf5f277f5
|
|
BLAKE2b-256 checksum How to use checksums |
9419a6af63582ac63abc3c570dbab18dcc6ef7356a92bdc5dae129bb62a876a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Darwin/19.6.0
|