Document git for windows env auto-prefix #481 (#487)

* Document git for windows env auto-prefix #481

Signed-off-by: Nenad Strainovic <nenad.strainovic@asseco-see.rs>
This commit is contained in:
Nenad Strainovic 2022-10-31 15:24:06 +01:00 committed by GitHub
parent 414f899c28
commit 3ac0cee50a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,13 @@
# Template Functions # Template Functions
#### `env`
The `env` function allows you to declare a particular environment variable as an optional for template rendering.
If the environment variable is unset or empty, the template rendering will continue with an empty string as a value.
```yaml
{{ $envValue := env "envName" }}
```
#### `requiredEnv` #### `requiredEnv`
The `requiredEnv` function allows you to declare a particular environment variable as required for template rendering. The `requiredEnv` function allows you to declare a particular environment variable as required for template rendering.
If the environment variable is unset or empty, the template rendering will fail with an error message. If the environment variable is unset or empty, the template rendering will fail with an error message.
@ -8,6 +16,8 @@ If the environment variable is unset or empty, the template rendering will fail
{{ $envValue := requiredEnv "envName" }} {{ $envValue := requiredEnv "envName" }}
``` ```
> If the environment variable value starts with '/' (forward slash) and [Git for Windows](https://git-scm.com/download/win) is used, you must set `MSYS_NO_PATHCONV=1` to preserve values as-is, or the environment variable value will be prefixed with the `C:\Program Files\Git`. [reference](https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md#known-issues)
#### `exec` #### `exec`
The `exec` function allows you to run a command, returning the stdout of the command. When the command fails, the template rendering will fail with an error message. The `exec` function allows you to run a command, returning the stdout of the command. When the command fails, the template rendering will fail with an error message.
@ -44,7 +54,7 @@ The `readDir` function returns a list of the relative paths to the files contain
``` ```
#### `readDirEntries` #### `readDirEntries`
The `readDirEntries` function returns a list of [https://pkg.go.dev/os#DirEntry](DirEntry) contained within the directory The `readDirEntries` function returns a list of [DirEntry](https://pkg.go.dev/os#DirEntry) contained within the directory
```yaml ```yaml
{{ range $index,$item := readDirEntries "./testdata/tmpl/sample_folder/" }} {{ range $index,$item := readDirEntries "./testdata/tmpl/sample_folder/" }}