Skip to content

Commit

Permalink
docs(readme): Move templating section below examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 29, 2024
1 parent 9981db9 commit ff24ef9
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,37 +118,6 @@ Install [yampl-bin](https://aur.archlinux.org/packages/yampl-bin) with your [AUR
[View the generated docs](docs/yampl.md) for flag and command reference.
Also, see [templating](#templating) and [example](#examples) sections.
## Templating
### Variables
All variables passed in with the `-v` flag are available during templating.
For example, the variable `-v tag=latest` can be used as `{{ .tag }}`.
### Functions
All [Sprig functions](https://masterminds.github.io/sprig/) are available in templates, along with some extras:
#### `current`
Returns the current YAML node's value.

#### `repo`

Splits a Docker repo and tag into the repo component:
```gotemplate
repo "nginx:stable-alpine"
```
The above produces `nginx`.

#### `tag`

Splits a Docker repo and tag into the tag component:
```gotemplate
tag "nginx:stable-alpine"
```
The above produces `stable-alpine`

## Examples
### Simple Examples
Expand Down Expand Up @@ -253,6 +222,37 @@ The above produces `stable-alpine`

</details>

## Templating

### Variables

All variables passed in with the `-v` flag are available during templating.
For example, the variable `-v tag=latest` can be used as `{{ .tag }}`.

### Functions

All [Sprig functions](https://masterminds.github.io/sprig/) are available in templates, along with some extras:

#### `current`

Returns the current YAML node's value.
#### `repo`
Splits a Docker repo and tag into the repo component:
```gotemplate
repo "nginx:stable-alpine"
```
The above produces `nginx`.
#### `tag`
Splits a Docker repo and tag into the tag component:
```gotemplate
tag "nginx:stable-alpine"
```
The above produces `stable-alpine`
## Advanced Usage
### Tags
Expand Down

0 comments on commit ff24ef9

Please sign in to comment.