Skip to content

Commit eb2bb66

Browse files
committed
update skill stepdef indentation rules
1 parent 242e035 commit eb2bb66

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

skills/shellkin/SKILL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,14 @@ Step definitions live in shell files under `step_definitions/` and use headers l
8484

8585
```bash
8686
@When I run '{command}'
87-
run "$command"
87+
run "$command"
8888
```
8989

9090
Follow these rules:
9191

9292
- Headers must begin with `@Given`, `@When`, or `@Then`.
9393
- The body continues until the next header or end of file.
94+
- Indent step bodies by two spaces for readability.
9495
- Use named `{tokens}` for variable parts.
9596
- Token names must start with a letter or underscore, then use letters, numbers, or underscores.
9697
- When a step matches, token values are exposed as shell variables in the body.

skills/shellkin/references/patterns.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,34 @@ Scenario: Show multiline output
4343

4444
```bash
4545
@Then the output should match
46-
[[ "$LAST_STDOUT" == "$DOC_STRING" ]]
46+
[[ "$LAST_STDOUT" == "$DOC_STRING" ]]
4747
```
4848

4949
## Reusable Command And Exit Steps
5050

5151
```bash
5252
@When I run '{command}'
53-
run "$command"
53+
run "$command"
5454

5555
@Then the exit code should be '{code}'
56-
[[ "$LAST_EXIT_CODE" -eq "$code" ]]
56+
[[ "$LAST_EXIT_CODE" -eq "$code" ]]
5757

5858
@Then the output should include '{text}'
59-
[[ "$LAST_STDOUT" == *"$text"* ]]
59+
[[ "$LAST_STDOUT" == *"$text"* ]]
6060

6161
@Then the error output should include '{text}'
62-
[[ "$LAST_STDERR" == *"$text"* ]]
62+
[[ "$LAST_STDERR" == *"$text"* ]]
6363
```
6464

6565
## Temp Directory Setup
6666

6767
```bash
6868
@Given I am in a temp directory
69-
old_pwd=$PWD
70-
temp_dir=$(mktemp -d)
71-
cd "$temp_dir"
72-
defer cd "$old_pwd"
73-
defer rm -rf "$temp_dir"
69+
old_pwd=$PWD
70+
temp_dir=$(mktemp -d)
71+
cd "$temp_dir"
72+
defer cd "$old_pwd"
73+
defer rm -rf "$temp_dir"
7474
```
7575

7676
Prefer `defer` over open-coded cleanup at the end of a step body.
@@ -79,10 +79,10 @@ Prefer `defer` over open-coded cleanup at the end of a step body.
7979

8080
```bash
8181
@Then the file '{path}' should exist
82-
[[ -f "$path" ]]
82+
[[ -f "$path" ]]
8383

8484
@Then the directory '{path}' should exist
85-
[[ -d "$path" ]]
85+
[[ -d "$path" ]]
8686
```
8787

8888
Use generic path-oriented steps when possible so they can be reused in many features.

0 commit comments

Comments
 (0)