#hcl #white-space #comments #modify #parse #preserving #document

hcl-edit

Parse and modify HCL while preserving comments and whitespace

37 releases

new 0.8.0 May 16, 2024
0.7.5 Jan 4, 2024
0.7.4 Sep 27, 2023
0.7.2 Jul 14, 2023
0.3.1 Mar 31, 2023

#656 in Encoding

Download history 313/week @ 2024-01-25 789/week @ 2024-02-01 427/week @ 2024-02-08 533/week @ 2024-02-15 491/week @ 2024-02-22 514/week @ 2024-02-29 431/week @ 2024-03-07 389/week @ 2024-03-14 635/week @ 2024-03-21 885/week @ 2024-03-28 802/week @ 2024-04-04 958/week @ 2024-04-11 1608/week @ 2024-04-18 1638/week @ 2024-04-25 1866/week @ 2024-05-02 1418/week @ 2024-05-09

6,794 downloads per month
Used in 13 crates (2 directly)

MIT/Apache

335KB
8K SLoC

hcl-edit

Build Status crates.io docs.rs License: Apache 2.0 License: MIT

Parse and modify HCL documents while preserving whitespace and comments. This crate is to HCL what toml_edit is to TOML. In fact, its API is heavily inspired by toml_edit.

Notice

The documentation as well as usage examples are scarce. There's still a lot of planned functionality missing and some APIs might even be cumbersome to use at the moment.

This will improve over time as this project evolves.

Expect breaking changes at any time until the biggest issues are fleshed out.

HCL document traversal

The visit module allows traversal of language items within a HCL document. Mutable document traversal is supported via the visit_mut module.

See the respective module's documentation for more.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md before creating a PR.

License

The source code of hcl-edit is licensed under either of Apache License, Version 2.0 or MIT license at your option.

Dependencies

~1MB
~20K SLoC