Closed loreanvictor closed 1 year ago
This command could also benefit from the proposed filtering of files if it were to support glob patterns, specifically to allow the content to also be evaluated per file. This could basically remove the need for the proposed append
and prepend
commands.
write: '{{ license }}\n{{ content }}'
to: **/*.(jsx?|tsx?|cpp|java)
where:
steps:
- read: content
from file: __file__
eval: '{{ content | not matches: /.../ }}'
base command added via 8ce8644. additional proposals (filtering and JSON / YAML support) should be tracked in separate issues (as they also involve multiple commands).
The command would simply write to a file. This can be useful for creating files without source templates, however the main idea is to allow the command to write to specific parts of a file, if they are for example
json
oryaml
files.JSON Pointer format is used here. I suspect json-source-map and mapped-yaml (or equivalent libraries) can be used to precisely alter some JSON or YAML file while maintaining its formatting as much as possible.