append_text

Operation for appending text to a given file.

Example

The following example appends text to a file named README.rst:

examples/operations/append_text.yml
steps:
    "Append text to project README":
        name: append_text
        file_path: "README.rst"
        text: |

            Example text
            ============

            Example of using `append_text` operation.

Note that the pipe character (|) used above is an example of yaml’s multi-line string syntax. This task assumes that there’s a file named README.rst in the working directory and will fail if that file doesn’t exist.

Required context

file_path

Path to file relative to the current working directory.

text

Text that will be appended to file_path

Optional context

prefix

default: 'n'

Text added before appended text

suffix

default: ''

Text added after appended text

See also