diff options
| author | Roland Huß <roland@ro14nd.de> | 2017-04-28 18:06:28 +0200 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2017-04-28 12:06:28 -0400 |
| commit | 082cba0a81c7d87b7fb7310c6bf65e4e4179d04a (patch) | |
| tree | eefd99e72387628ff3c9aca8f680adde66084bc2 /README.md | |
| parent | 5649b5bf144156dafebe0e1a0cbf694e222f1391 (diff) | |
Add --input-dir and --output-dir as options (#119)
All filese from --input-dir will be processed as templates and stored
with the same directory hierachy in --ouput-dir
- Use both options when a whole directory hierarchy needs to be processed.
- Extracted file processing logic in an extra process.go
- --output-dir is optional and default to "."
- --output-dir is created automatically if not existing
Fixes #117
Signed-off-by: Roland Huss <roland@ro14nd.de>
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -194,6 +194,18 @@ By default, `gomplate` will read from `Stdin` and write to `Stdout`. This behavi You can specify multiple `--file` and `--out` arguments. The same number of each much be given. This allows `gomplate` to process multiple templates _slightly_ faster than invoking `gomplate` multiple times in a row. +##### `--input-dir` and `--output-dir` + +For processing multiple templates in a directory you can use `--input-dir` and `--output-dir` together. In this case all files in input directory will be processed as templates and the resulting files stored in `--output-dir`. The output directory will be created if it does not exist and the directory structure of the input directory will be preserved. + +Example: + +```bash +# Process all files in directory "templates" with the datasource given +# and store the files with the same directory structure in "config" +gomplate --input-dir=templates --output-dir=config --datasource config=config.yaml +``` + #### `--datasource`/`-d` Add a data source in `name=URL` form. Specify multiple times to add multiple sources. The data can then be used by the [`datasource`](#datasource) function. |
