A small utility to read keys from TOML files.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file outcome-read-toml-2.0.3.tar.gz.
File metadata
- Download URL: outcome-read-toml-2.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.6 Linux/5.4.0-1031-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6aecc0e0b2074bf6ef85f78d2d604ced8af0c7d9bb92e4ee8b36880db35ec8a
|
|
| MD5 |
2991378290bbe8775765c3dcfbe3c75d
|
|
| BLAKE2b-256 |
dc1e4888a6ca48a8c9d698bfcbc7f3082a72e560ed27654cd42aefc3879d8e34
|
File details
Details for the file outcome_read_toml-2.0.3-py3-none-any.whl.
File metadata
- Download URL: outcome_read_toml-2.0.3-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.6 Linux/5.4.0-1031-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9098346e869d2411390c3113a260499786db8afd79acc997bc5ddb117d73d463
|
|
| MD5 |
27282a7fd36181236b921d24ee96df86
|
|
| BLAKE2b-256 |
2598d6382b3d6504d2a58ac5eb02fc50250a69b15cb9ac4edfe69f0ed21e7f41
|