Implement take command and comments (--) + misc cleanup

This commit is contained in:
2026-04-10 10:48:21 -05:00
parent 4dec54893c
commit 525f4bd065
8 changed files with 118 additions and 4 deletions

18
HELP.md
View File

@@ -62,6 +62,18 @@ str %> replace oo OO; replace ba BA
str %>
```
Comments start with `--` and run through the end of the line. Example:
```text
str %> = abc -- my comment
┌───────────────
│ 0 │abc
├───────────────
│ :: string
└───────────────
str %>
```
## Data Types
@@ -231,6 +243,12 @@ Delete the specified word/line/index from the current subject.
`index` is applied for destructured subjects. For destructured subjects you may omit the type (e.g. `drop 4`).
Example: `foo bar baz` -> `drop word 1` -> `foo baz`
#### `take <word|line|index> <index>`
Keep only the specified word/line/index from the current subject.
`word` and `line` apply to strings that have not been destructured.
`index` is applied for destructured subjects. For destructured subjects you may omit the type (e.g. `take 4`).
Example: `foo bar baz` -> `take word 1` -> `bar`
#### `contains <find>`
If the subject contains the given substring, keep it. Otherwise, replace it with an empty string.
Most often used in conjunction with `line`, `word`, or `each` for filtering.