Skip to content

Commit

Permalink
docs: added text type docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Feb 9, 2024
1 parent f81c4a3 commit 8472f4f
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started/_category_.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
label: 🚀 Getting Started
label: Getting Started
position: 2
collapsed: false
1 change: 0 additions & 1 deletion docs/getting-started/run-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ template: |-
{{ range .Users }}
- {{ .Name }} is an admin: {{ .Admin }}
{{ end }}
```
This is a simple example of a GTTP template.
Expand Down
2 changes: 1 addition & 1 deletion docs/syntax/_category_.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
label: ✍️ Syntax
label: Syntax
position: 2
collapsed: false
18 changes: 9 additions & 9 deletions docs/syntax/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ structures:
description: Lastname of the person

variables:
- name: UserA
type: person
description: A person
- name: UserB
type: person
description: Another person
- name: UserA
type: person
description: A person
- name: UserB
type: person
description: Another person

template: |-
Hello, {{ .UserA.Name }} {{ .UserA.Lastname }}!
Hello, {{ .UserB.Name }} {{ .UserB.Lastname }}!
Hello, {{ .UserA.Name }} {{ .UserA.Lastname }}!
Hello, {{ .UserB.Name }} {{ .UserB.Lastname }}!
```
When executing the template, GTTP will interactively ask you to fill out the defined variables:
Expand All @@ -107,7 +107,7 @@ When executing the template, GTTP will interactively ask you to fill out the def
```
When all variables are filled out, GTTP will parse the template to:
```
Hello, John Doe!
Hello, Jane Doe!
Expand Down
1 change: 1 addition & 0 deletions docs/syntax/types/number.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Number
Empty file removed docs/syntax/types/number.yml
Empty file.
46 changes: 46 additions & 0 deletions docs/syntax/types/text.md
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
# Text

The `text` type can be used to define variables that accept text input.

## Basic

Basic syntax for the `text` type:

```yaml
variables:
- name: Name
type: text # Set the type to text
description: Name of the person
template: |-
Hello, {{ .Name }}!
```
## Multiline
You can use the `multiline` property to define a multiline text input:

```yaml
variables:
- name: Description
type: text
multiline: true # Set the multiline property to true
description: Description of the person
template: |-
Description:
{{ .Description }}
```

## Validation

### Regex

You can use the `regex` property to define a regular expression for validation:

```yaml
variables:
- name: Text
type: text
regex: ^[a-z]+$ # only allow lowercase letters
description: A string of lowercase letters
template: |-
{{ .Text }}
```

0 comments on commit 8472f4f

Please sign in to comment.