├── .gitattributes ├── .github └── workflows │ └── main.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── build.zig └── src └── main.zig /.gitattributes: -------------------------------------------------------------------------------- 1 | *.zig text eol=lf 2 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: push 3 | jobs: 4 | test: 5 | strategy: 6 | matrix: 7 | os: [ubuntu-latest, macos-latest] 8 | runs-on: ${{matrix.os}} 9 | steps: 10 | - uses: actions/checkout@v1 11 | with: 12 | submodules: recursive 13 | - uses: goto-bus-stop/setup-zig@v1.0.0 14 | with: 15 | version: 0.6.0 16 | - run: zig build 17 | lint: 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v1 21 | - uses: goto-bus-stop/setup-zig@v1.0.0 22 | with: 23 | version: 0.6.0 24 | - run: zig fmt --check . 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | zig-cache 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/zig-clap"] 2 | path = lib/zig-clap 3 | url = https://github.com/Hejsil/zig-clap.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 TM35-Metronome 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hacky-zig-repl 2 | 3 | Just a small wrapper program that provides a repl for the [Zig](https://ziglang.org/) programming language. 4 | -------------------------------------------------------------------------------- /build.zig: -------------------------------------------------------------------------------- 1 | const Builder = @import("std").build.Builder; 2 | 3 | pub fn build(b: *Builder) void { 4 | const mode = b.standardReleaseOptions(); 5 | const exe = b.addExecutable("hacky-zig-repl", "src/main.zig"); 6 | exe.addPackagePath("zig-clap", "lib/zig-clap/clap.zig"); 7 | exe.setBuildMode(mode); 8 | 9 | const run_cmd = exe.run(); 10 | const run_step = b.step("run", "Run the app"); 11 | run_step.dependOn(&run_cmd.step); 12 | 13 | b.default_step.dependOn(&exe.step); 14 | b.installArtifact(exe); 15 | } 16 | -------------------------------------------------------------------------------- /src/main.zig: -------------------------------------------------------------------------------- 1 | const clap = @import("zig-clap"); 2 | const std = @import("std"); 3 | 4 | const base64 = std.base64; 5 | const crypto = std.crypto; 6 | const debug = std.debug; 7 | const fmt = std.fmt; 8 | const fs = std.fs; 9 | const heap = std.heap; 10 | const io = std.io; 11 | const math = std.math; 12 | const mem = std.mem; 13 | const os = std.os; 14 | 15 | const Clap = clap.ComptimeClap(clap.Help, ¶ms); 16 | const Names = clap.Names; 17 | const Param = clap.Param(clap.Help); 18 | 19 | const params = [_]Param{ 20 | clap.parseParam("-h, --help display this help text and exit ") catch unreachable, 21 | clap.parseParam("-t, --tmp