From 082cba0a81c7d87b7fb7310c6bf65e4e4179d04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Fri, 28 Apr 2017 18:06:28 +0200 Subject: 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 --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 9c0da279..9ca740bd 100644 --- a/README.md +++ b/README.md @@ -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. -- cgit v1.2.3