Variables (and constants)

How to use variables in tasks

Variables are a part of every command.

All variables are used like this:

tasks:
  default:
    commands:
      - echo ${variable}

They are automatically injected during execution of the Puff File, i.e., at runtime.

There are two types of variables:

  • Constants (predefined values in the Puff File)

  • Arguments

Constants

Constants are defined in the variables field of the Puff File:

variables:
  test_variable: Hello, world!

Arguments

Arguments are defined per task:

tasks:
  default:
    arguments:
      - name: var
      - name: var2
        default: I'am gustavo
    commands:
      - echo ${var} ${var2}

And used like this:

$ puff "Hello world!"
Hello, world! I'am gustavo
$ puff "Hello world!" "I'am bob"
Hello world! I'am bob

Last updated