textrun-workspace
v0.2.0
Published
Text-Runner actions for the Text-Runner workspace
Downloads
6
Readme
Text-Runner Actions for the Text-Runner workspace
This package provides Text-Runner actions for working with files.
installation
To use these actions, add this package as a development dependency by running
or
cd action
The workspace/working-dir action changes the current working directory into the given directory inside the workspace. As an example, consider the following documentation snippet:
Create a
<code type="workspace/new-directory">foo</code>
directory. Now you can change into it via this Markdown code:
<code type="workspace/working-dir">foo</code>
create-directory
The workspace/new-directory action creates a directory with the given name in the workspace. Here is a usage example:
Create a directory named <b type="workspace/new-directory">utils</b>.
When executing this Markdown snippet, Text-Runner will create a utils directory in the workspace, just as the user would.
create-file
The workspace/new-file action creates a file in the workspace. This action assumes that the documentation writes the filename in emphasized or bold text and the file content as a code block with one or three backticks. As an example, consider the following documentation snippet:
<a type="workspace/new-file">Please create a file _apples.txt_ with the content
`Fuji`.</a>
When executing the documentation, Text-Runner will create a file with name
apples.txt and content Fuji
.
Alternatively, the documentation could also read like this:
<a type="workspace/new-file">
Please create a file with name **more-apples.txt** and the content:
```
Gala
```
</a>
Similarly, Text-Runner will create a file
more-apples.txt with content Gala
.
directory
The workspace/existing-directory action verifies that the workspace contains a directory with the given name. As an example, consider this documentation snippet:
Please run the command <code type="shell/command">mkdir images</code>. If
everything goes well, your computer will now have a new directory
<i type="workspace/existing-directory">images</i>. You can store images in it.
file-content
The workspace/existing-file action verifies that a file with the given name exists and has the given content. This action assumes that the documentation contains the filename as emphasized or strong text and the file content as a code block with single or triple backticks. As an example, consider the following documentation snippet:
Assuming a file <a type="workspace/new-file">_hello.txt_ with content
`hello world`</a>, we can verify it via this action:
<a type="workspace/existing-file">The file _hello.txt_ now contains
`hello world`.</a>
specifying the directory
By default, actions in this plugin create the files in the workspace. To create
them in a different directory, provide a dir
attribute at the region marker
containing the relative path to the directory to use. As an example, consider
the following documentation snippet:
<a type="workspace/new-file" dir="subdir">
Please create a file _apples.txt_ with the content `Boskoop`.
</a>
When executing the documentation, Text-Runner will create a file
subdir/apples.txt and content Boskoop
.