{"id":13566260,"url":"https://github.com/gnprice/toml-cli","last_synced_at":"2025-09-11T05:40:28.503Z","repository":{"id":40414872,"uuid":"205495411","full_name":"gnprice/toml-cli","owner":"gnprice","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-19T03:44:34.000Z","size":101,"stargazers_count":101,"open_issues_count":14,"forks_count":21,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-03-15T07:23:46.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gnprice.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-31T04:34:07.000Z","updated_at":"2024-06-18T22:39:40.669Z","dependencies_parsed_at":"2024-06-18T22:39:33.729Z","dependency_job_id":"7af0a3a1-c0e3-41d2-aeb4-b3b33a635704","html_url":"https://github.com/gnprice/toml-cli","commit_stats":{"total_commits":100,"total_committers":3,"mean_commits":"33.333333333333336","dds":"0.020000000000000018","last_synced_commit":"6a41f2da04679ba29f944571915bdf183eb0eeec"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnprice%2Ftoml-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnprice%2Ftoml-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnprice%2Ftoml-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnprice%2Ftoml-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gnprice","download_url":"https://codeload.github.com/gnprice/toml-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411239,"owners_count":20934653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:02:05.643Z","updated_at":"2025-04-05T23:11:57.749Z","avatar_url":"https://github.com/gnprice.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# toml-cli\n\nThis is the home of the `toml` command, a simple CLI for editing\nand querying TOML files.\n\nThe intent of the `toml` command is to be useful\n * in shell scripts, for consulting or editing a config file;\n * and in instructions a human can follow for editing a config file,\n   as a command to copy-paste and run.\n\nA source of inspiration for the interface is the `git config` command,\nwhich serves both of these purposes very well without knowing anything\nabout the semantics of Git config files -- only their general\nstructure.\n\nA key property is that when editing, we seek to *preserve formatting\nand comments* -- the only change to the file should be the one the\nuser specifically asked for.  To do this we rely on the `toml_edit`\ncrate, which also underlies `cargo-edit`.  There are a few edge cases\nwhere `toml_edit` can rearrange an oddly-formatted file (described in\nthe `toml_edit` documentation); but for typical TOML files, we\nmaintain this property with perfect fidelity.\n\nThe command's status is **experimental**.  The current interface does\nnot yet serve its purposes as well as it could, and **incompatible\nchanges** are anticipated.\n\n\n## Installation\n\n### Linux download\n\n[Precompiled binaries are published for Linux.][releases]\nThe binaries are static executables, and work on any Linux\ndistribution.\n\nCurrently no binaries are published for other platforms.\nDoing so for more platforms is a desired future step\n([#22], [#21], [#5]).  In the meantime, see Cargo instructions below.\n\n[releases]: https://github.com/gnprice/toml-cli/releases\n\n\n### Using Cargo\n\nIf you have Cargo (the Rust build tool) installed, you can install the\n`toml` CLI by running:\n```\n$ cargo install toml-cli\n```\n\nTo install Cargo, follow the instructions [on rust-lang.org][install-rust].\n\n[install-rust]: https://www.rust-lang.org/learn/get-started\n\n[#5]: https://github.com/gnprice/toml-cli/issues/5\n[#21]: https://github.com/gnprice/toml-cli/issues/21\n[#22]: https://github.com/gnprice/toml-cli/issues/22\n\n\n## Usage\n\n### Reading: `toml get`\n\nTo read specific data, pass a *TOML path*: a sequence of *path\nsegments*, each of which is either:\n * `.KEY`, to index into a table or inline-table, or\n * `[INDEX]`, to index into an array-of-tables or array.\n\nData is emitted by default as JSON:\n\n```\n$ toml get Cargo.toml bin[0]\n{\"name\":\"toml\",\"path\":\"src/main.rs\"}\n```\n\nWhen the data is a string, the `--raw`/`-r` option prints it directly,\nfor convenience in contexts like a shell script:\n\n```\n$ toml get Cargo.toml dependencies.serde --raw\n1.0\n```\n\nIf you need a more complex query, consider a tool like `jq`, with\n`toml` simply transforming the file to JSON:\n\n```\n$ toml get pyoxidizer.toml . | jq '\n    .embedded_python_config[] | select(.build_target | not) | .raw_allocator\n  ' -r\njemalloc\n```\n\n(The TOML path `.` is an alias for the empty path, describing the\nwhole file.)\n\n### Writing (ish): `toml set`\n\nTo edit the data, pass a TOML path specifying where in the parse tree\nto put it, and then the data value to place there:\n\n```\n$ cat \u003efoo.toml \u003c\u003cEOF\n[a]\nb = \"c\"\nEOF\n\n$ toml set foo.toml x.y z\n[a]\nb = \"c\"\n\n[x]\ny = \"z\"\n```\n\nThis subcommand is quite raw in two respects:\n * We don't actually edit the file; we only print out the new version.\n * The value to be set must be a string; input of booleans, arrays, etc.\n   is unimplemented.\n\n## Reference\n\n### Base command `toml`\n\n```\n$ toml --help\ntoml-cli 0.2.3\nA simple CLI for editing and querying TOML files.\n\nUSAGE:\n    toml \u003cSUBCOMMAND\u003e\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nSUBCOMMANDS:\n    get     Print some data from the file\n    help    Prints this message or the help of the given subcommand(s)\n    set     Edit the file to set some data (currently, just print modified version)\n```\n\n### `toml get`\n\n```\n$ toml get --help\ntoml-get 0.2.3\nPrint some data from the file\n\nRead the given TOML file, find the data within it at the given query,\nand print.\n\nIf the TOML document does not have the given key, exit with a\nfailure status.\n\nOutput is JSON by default.  With `--raw`/`-r`, if the data is a\nstring, print it directly.  With `--output-toml`, print the data\nas a fragment of TOML.\n\nUSAGE:\n    toml get [FLAGS] \u003cpath\u003e \u003cquery\u003e\n\nFLAGS:\n    -h, --help           Prints help information\n        --output-toml    Print as a TOML fragment (default: print as JSON)\n    -r, --raw            Print strings raw, not as JSON\n    -V, --version        Prints version information\n\nARGS:\n    \u003cpath\u003e     Path to the TOML file to read\n    \u003cquery\u003e    Query within the TOML data (e.g. `dependencies.serde`, `foo[0].bar`)\n```\n\n### `toml set`\n\n```\n$ toml set --help\ntoml-set 0.2.3\nEdit the file to set some data (currently, just print modified version)\n\nUSAGE:\n    toml set \u003cpath\u003e \u003cquery\u003e \u003cvalue-str\u003e\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nARGS:\n    \u003cpath\u003e         Path to the TOML file to read\n    \u003cquery\u003e        Query within the TOML data (e.g. `dependencies.serde`, `foo[0].bar`)\n    \u003cvalue-str\u003e    String value to place at the given spot (bool, array, etc. are TODO)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnprice%2Ftoml-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnprice%2Ftoml-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnprice%2Ftoml-cli/lists"}