Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rule replace

replace lines in files with set of rules

Why?

Indentation

Because python, yaml and similar are based on the proper identation. Using there jinja/sed/awk - you name it - can cause a lot of errors. This is a solution.

Multiple replacement rules

You want multiple replacement rules? Are you tired of the chains of seds? Here you go!

Building

  1. Install rust
  2. Build the software
git clone https://github.com/Dzordzu/rule-replace
cd ./rule-replace
cargo build --release

Usage example

In shell rule-replace -c config.toml -f input.txt

config.toml

[[rule]]
replace.lines_between = ["# BEGIN", "# END"]
keep_spaces = true

    [rule.with]
    template = "./template.j2"
    values = "./values.json"

For more see example directory. Inputs and expected outputs are presented within each suite tests subdirectory.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages