0.2.0 • Published 2 years ago

textrun-workspace v0.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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

.

0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

3 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.2

4 years ago

0.0.4

4 years ago

0.0.1

4 years ago