Crates.io | tomli |
lib.rs | tomli |
version | 0.1.1 |
source | src |
created_at | 2024-09-07 13:15:49.295041 |
updated_at | 2024-09-28 20:01:52.070249 |
description | A simple CLI for quering and editing TOML files |
homepage | |
repository | https://github.com/blinxen/tomli |
max_upload_size | |
id | 1367192 |
size | 46,758 |
tomli
is a format preserving command-line tool for querying and editing TOML files.
This project is currently under development and the command-line interface can change at any time.
cargo install tomli
By default, tomli
will read from stdin unless --filepath
is specified.
tomli
tries to use the same syntax as jq
for query expressions.
The following expressions are currently supported:
foo.bar
or .
(whole document)foo[0]
or foo.bar[0][1]
Examples:
Get the value of the name
key from the package
table:
tomli query -f Cargo.toml package.name
Get the first element of the array called bin
:
tomli query -f Cargo.toml bin[0]
tomli
currently supports the following types when setting a value:
The value type can be specified with the --type
argument.
If not type is specified, then str
is used.
Examples:
Add a new key to the package
table called website
:
tomli set -f Cargo.toml package.website https://example.com
Set the name
of the first element in the bin
array to tumli
:
tomli set -f Cargo.toml bin[0].name tumli
Add a new table called website
to the first element of the bin
array:
tomli set -f Cargo.toml bin[0].website.url https://example.com
Delete name
in the table package
:
tomli delete -f Cargo.toml package.name
Delete the first element in the array authors:
tomli delete -f Cargo.toml package.authors[0]