https://github.com/kuper-adrian/yvar
Command-line tool to replace placeholders in files
https://github.com/kuper-adrian/yvar
cli javascript json nodejs yml
Last synced: 2 months ago
JSON representation
Command-line tool to replace placeholders in files
- Host: GitHub
- URL: https://github.com/kuper-adrian/yvar
- Owner: kuper-adrian
- License: mit
- Created: 2018-12-13T22:43:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-16T15:53:43.000Z (over 7 years ago)
- Last Synced: 2025-11-27T12:25:23.855Z (7 months ago)
- Topics: cli, javascript, json, nodejs, yml
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yvar - replace placeholders in files
yvar is a tiny command-line tool that replaces placeholders, that look like `$_{ FOO }`, with some other value. For example, look at this `example.yml` file:
```yaml
example:
answer: $_{ ANSWER }
```
Now run yvar:
```
yvar example.yml example.out.yml --ANSWER 42
```
The result will be the following file named `example.out.yml`:
```yaml
example:
answer: 42
```
yvar should work with all kinds of text files, e.g. `json`.
I'm not to sure if this tool has any real-world use cases, but I personally use it in my continuous deployment setup to create environment specific `docker-compose.override.yml` files during builds.
Also if you have bugs or improvements, feel free to open an issue on GitHub.
## Install
```
npm install yvar
```
or if you want to use it globally with the `yvar` command
```
npm install -g yvar
```
## Use
Any yvar command has to following structure:
```
yvar INPUT_FILE OUTPUT_FILE [VARS]
```
* `INPUT_FILE`: path to file that contains placeholders
* `OUTPUT_FILE`: path of file that holds result
* `[VARS]`: List all placeholders with their replacement using `--`. I.e. if you want to replace `$_{ FOO }` with "bar", append `--FOO bar` to the command
## License
MIT