Skip to content

Commit

Permalink
Use a zig build script to run ziglings
Browse files Browse the repository at this point in the history
  • Loading branch information
SpexGuy committed Feb 12, 2021
1 parent 0ad4a0b commit 971ab7f
Show file tree
Hide file tree
Showing 5 changed files with 573 additions and 140 deletions.
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://git-scm.com/docs/gitattributes
# See https://help.github.com/articles/dealing-with-line-endings/

# Default behavior, if core.autocrlf is unset.
* text=auto

# Files to be converted to native line endings on checkout.
*.cpp text
*.h text

# Text files to always have CRLF (dos) line endings on checkout.
*.bat text eol=crlf

# Text files to always have LF (unix) line endings on checkout.
*.sh text eol=lf
*.zig text eol=lf

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*~
*.swp
zig-cache/
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,35 @@ git clone https://github.com/ratfactor/ziglings
cd ziglings
```

Then run the `ziglings` script and follow the instructions to begin!
Then run `zig build` and follow the instructions to begin!

```bash
./ziglings
zig build
```

## Manual Usage

If you can't (or don't want to) use the script, you can manually verify each
exercise with the Zig compiler:
If you want to run a single file for testing, you can do so with this command:

```bash
zig run exercises/01_hello.zig
```
or, alternatively
```bash
zig build 01_test
```

To verify a single file, use

```bash
zig build 01_only
```

To prepare an executable for debugging, install it to zig-cache/bin with

```bash
zig build 01_install
```

## TODO

Expand All @@ -66,7 +81,6 @@ the learning resource I wished for. There will be tons of room for improvement:
* Wording of explanations
* Idiomatic usage of Zig
* Additional exercises
* Re-write the `ziglings` script using the Zig build system (or just a Zig application)

Planned exercises:

Expand Down
Loading

0 comments on commit 971ab7f

Please sign in to comment.