RKD command-line usage is highly inspired by GNU Make and Gradle, but it has its own extended possibilities to make your scripts smaller and more readable.

  • Tasks are prefixed always with “:”.
  • Each task can handle it’s own arguments (unique in RKD)
  • “@” allows to propagate arguments to next tasks (unique in RKD)

Tasks arguments usage in shell and in scripts

Executing multiple tasks in one command:

rkd :task1 :task2

Multiple tasks with different switches:

rkd :task1 --hello  :task2 --world

Tasks sharing the same switches

Both tasks will receive switch “–hello”

# expands to:
#  :task1 --hello
#  :task2 --hello
rkd @ --hello :task1 :task2

# handy, huh?

Advanced usage of shared switches

Operator “@” can set switches anytime, it can also clear or replace switches in NEXT TASKS.

# expands to:
#   :task1 --hello
#   :task2 --hello
#   :task3
#   :task4 --world
#   :task5 --world
rkd @ --hello :task1 :task2 @ :task3 @ --world :task4 :task5

Written as a pipeline (regular bash syntax)

It’s exactly the same example as above, but written multiline. It’s recommended to write multiline commands if they are longer.

rkd @ --hello \
    :task1 \
    :task2 \
    :task3 \
    @ --world \
    :task4 \

YAML syntax - makefile.yaml

YAML syntax has an advantage of simplicity and clean syntax, custom bash tasks can be defined there easier than in Python. To use YAML you need to define makefile.yaml file in .rkd directory.

NOTICE: and makefile.yaml can exist together. Python version will be loaded first, the YAML version will append changes in priority.

version: org.riotkit.rkd/0.3
  - rkd.standardlib.docker.TagImageTask

  # see this task in "rkd :tasks"
  # run with "rkd :examples:bash-test"
      description: Execute an example command in bash - show only python related tasks
      steps: |
             echo "RKD_DEPTH: ${RKD_DEPTH} # >= 2 means we are running rkd-in-rkd"
             echo "RKD_PATH: ${RKD_PATH}"
             rkd --silent :tasks | grep ":py"

  # try "rkd :examples:arguments-test --text=Hello --test-boolean"
      description: Show example usage of arguments in Bash
              help: "Adds text message"
              required: True
              help: "Example of a boolean flag"
              action: store_true # or store_false
        - |
          echo " ==> In Bash"
          echo " Text: ${ARG_TEXT}"
          echo " Boolean test: ${ARG_TEST_BOOLEAN}"
        - |
          print(' ==> In Python')
          print(' Text: %s ' % ctx.args['text'])
          print(' Text: %s ' % str(ctx.args['test_boolean']))
          return True

  # run with "rkd :examples:list-standardlib-modules"
      description: List all modules in the standardlib
        - |
          ctx: ExecutionContext
          this: TaskInterface

          import os

          print('Hello world')

          return True

What’s loaded first? See Paths and inheritance