reverse cli command
This commit is contained in:
23
README.md
23
README.md
@@ -170,6 +170,29 @@ The map contains a flat lookup from rendered strings to template tokens plus per
|
||||
}
|
||||
```
|
||||
|
||||
## Reverse CLI
|
||||
|
||||
Use the reverse map to rebuild template files from an edited rendered directory:
|
||||
|
||||
```sh
|
||||
tdir reverse ./output ./templates
|
||||
```
|
||||
|
||||
Without installing the package first, run the published CLI through Bun:
|
||||
|
||||
```sh
|
||||
bunx @gregorlohaus/tdir reverse ./output ./templates
|
||||
```
|
||||
|
||||
By default, the command reads `./output/.tdir-map.json`. Use `--map` for a custom map path relative to the rendered directory:
|
||||
|
||||
```sh
|
||||
tdir reverse ./output ./templates --map meta/reverse-map.json
|
||||
bunx @gregorlohaus/tdir reverse ./output ./templates --map meta/reverse-map.json
|
||||
```
|
||||
|
||||
The command writes files at their original template paths and restores recorded `<@var(...)>` tokens in file contents and file paths. It does not infer conditional blocks that were removed during rendering; keep the original template structure when those blocks need to be preserved.
|
||||
|
||||
## Unmatched directives
|
||||
|
||||
A `<@if>` without a matching `<@endif>` throws when the renderer is initialized:
|
||||
|
||||
Reference in New Issue
Block a user