Skip to content

Commit

Permalink
Merge pull request #76 from mobusoperandi/readme
Browse files Browse the repository at this point in the history
readme
  • Loading branch information
mightyiam authored Feb 20, 2024
2 parents 4ae18b7 + d713d8f commit 98a49af
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# eelco
This is a CLI that reads markdown files,
extracts Nix examples from them and
tests these examples.

> [Nix](https://nixos.org) doctests CLI
Two kinds of examples are supported:

1. expression examples
2. repl examples

Expression examples look like this:

````md
```nix
assert 1 + 1 == 2; null
```
````

They are nix expressions inside of fenced code blocks.
The first word in their info string is `nix`.
The expression is passed to Nix for evaluation as `nix eval --expr <EXPRESSION>`.
For future compatibility, to be considered passing,
it must successfully evaluate into `null`.
It is expected of the author to demonstrate and prove their points
using assertions.

Repl exaples look like this;

````md
```nix-repl
nix-repl> a = 1

nix-repl> a + 1
2

```
````

Repl examples will be evaluated by the real Nix repl.
At the moment, expressions and assignments queries are supported.
A line that follows an expression query will be used as an assertion.
Blank lines matter. Even trailing ones.

0 comments on commit 98a49af

Please sign in to comment.