Skip to content

Latest commit

 

History

History
155 lines (115 loc) · 3.4 KB

create_task.md

File metadata and controls

155 lines (115 loc) · 3.4 KB

CreateTask

Creates a new path in the destination directory.

When using source templates, the src.path attribute may be a file or a directory path. When the latter, the source directory will be copied to the destination path recursively.

Examples:

tasks:
  - type: create
    # Render <./_src/README.tpl> (using the values defined in the generator)
    # and write it to <./README.md> in the destination directory.
    # If the README file already exists in the destination dir,
    # keep the existing file and do not bother prompting the user.
    src:
      path: "README.tpl"
    dst:
      path: "README.md"
      conflict: keep
values:
  - key: "FirstName"
    default: "Some Name"

tasks:
  - type: create
    # Render the inline content as a template and write it to
    # <./some_name/greeting.txt> in the destination directory.
    src:
      content: "Hello, {{ .FirstName }}!"
    dst:
      path: "{{ .FirstName | underscore }}/greeting.txt"
tasks:
  - type: create
    # Render all the files in <./_src/scripts/> (using the values defined in the generator),
    # copy them to <./scripts/> in the destination directory, then make them executable.
    src:
      path: "scripts/"
    dst:
      path: "scripts/"
      mode: "0755"

Properties

Property Type Required Enum Default Description
dst Destination

The destination path.

each string

Set to a comma separated value and the task will be executued once per-item.

if string "true"

Determines whether the task should be executed.

src Source

The source path or inline content.

type string "create"

Creates a new path in the destination directory.

dst

Type Required Enum Default
Destination

The destination path.

Examples:

dst:
    path: README.md
dst:
    mode: "0755"
    path: bin/build.sh

each

Type Required Enum Default
string

Set to a comma separated value and the task will be executued once per-item. On each iteration, the _Item and _Index values will be set accordingly.

Examples:

each: foo, bar, baz
each: '{{ .SomeList | join "," }}'

if

Type Required Enum Default
string "true"

Determines whether the task should be executed. The value must be coercible to a boolean.

Examples:

if: "true"
if: '{{ .SomeBool }}'

src

Type Required Enum Default
Source

The source path or inline content.

Examples:

src:
    path: README.tpl
src:
    content: Hello, {{ .FirstName }}!

type

Type Required Enum Default
string "create"

Creates a new path in the destination directory.

Allowed Values:

  • "create"

Examples:

type: create