Skip to content

Commit c837c55

Browse files
committed
C++ Structure update
1 parent cb063f6 commit c837c55

23 files changed

Lines changed: 25904 additions & 945 deletions

.github/workflows/cpp.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: C++ CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Cache CMake build directory
21+
uses: actions/cache@v3
22+
with:
23+
path: |
24+
src/build
25+
key: ${{ runner.os }}-cmake-${{ hashFiles('src/CMakeLists.txt') }}-${{ hashFiles('src/src/**', 'src/include/**') }}
26+
restore-keys: |
27+
${{ runner.os }}-cmake-
28+
29+
- name: Configure
30+
run: cmake -S src -B src/build -DCMAKE_BUILD_TYPE=Release
31+
32+
- name: Build
33+
run: cmake --build src/build --config Release

.github/workflows/zig.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ test/test.o
2424
test/stack.yaml.lock
2525
test/app/test.exe
2626

27-
.zig-cache/
28-
zig-out/
27+
src/build/
2928
test/Haskell/app/test.exe
3029
test/Haskell/app/test.hi
3130
test/Haskell/app/test.o
3231
test/Haskell/app/test
3332

3433
test/NodeJS/node_modules/
35-
test/NodeJS/package-lock.json
34+
test/NodeJS/package-lock.json

Makefile

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,33 @@
1-
ZIG ?= zig
2-
OPT ?= ReleaseFast
3-
WINDOWS_TARGET ?= x86_64-windows-gnu
1+
BUILD_DIR ?= src/build
2+
PREFIX ?= /usr/local
3+
CMAKE ?= cmake
4+
CMAKE_BUILD_TYPE ?= Release
5+
ARGS ?=
46

5-
ifeq ($(OS),Windows_NT)
6-
HOST_OS := Windows
7-
else
8-
HOST_OS := $(shell uname -s 2>/dev/null)
9-
endif
10-
11-
ifeq ($(HOST_OS),Windows)
12-
DEFAULT_PREFIX ?= $(LOCALAPPDATA)/Programs/zippy
13-
else
14-
DEFAULT_PREFIX ?= /usr/local
15-
endif
16-
17-
PREFIX ?= $(DEFAULT_PREFIX)
18-
PREFIX_FLAG = $(if $(PREFIX),-p $(PREFIX),)
19-
20-
.PHONY: build build-linux build-windows install clean help
7+
.PHONY: build run install clean help
218

229
build:
23-
$(ZIG) build -Doptimize=$(OPT)
24-
25-
build-linux: build
10+
$(CMAKE) -S src -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
11+
$(CMAKE) --build $(BUILD_DIR)
2612

27-
build-windows:
28-
$(ZIG) build -Doptimize=$(OPT) -Dtarget=$(WINDOWS_TARGET)
13+
run: build
14+
$(BUILD_DIR)/zippy $(ARGS)
2915

30-
install:
31-
$(ZIG) build -Doptimize=$(OPT) install $(PREFIX_FLAG)
32-
@echo "Installed to $(PREFIX)/bin (ensure this is on PATH)."
33-
@if [ "$(HOST_OS)" = "Windows" ]; then \
34-
printf "Add to PATH (PowerShell): [Environment]::SetEnvironmentVariable(\"Path\", \"%s;$(PREFIX)/bin\", \"User\")\n" "$$(powershell -NoProfile -Command "[Environment]::GetEnvironmentVariable('Path','User')")"; \
35-
else \
36-
echo "Add to PATH (bash): export PATH=\"$(PREFIX)/bin:\$$PATH\""; \
37-
fi
16+
install: build
17+
install -d $(PREFIX)/bin
18+
install $(BUILD_DIR)/zippy $(PREFIX)/bin/zippy
19+
@echo "Installed to $(PREFIX)/bin/zippy"
20+
@echo "Add to PATH (bash): export PATH=\"$(PREFIX)/bin:\$$PATH\""
3821

3922
clean:
40-
$(ZIG) build --clean
23+
rm -rf $(BUILD_DIR)
4124

4225
help:
4326
@echo "Targets:"
44-
@echo " build Build for host (Arch/Linux)"
45-
@echo " build-windows Cross-compile for Windows (x86_64)"
46-
@echo " install Install to host-appropriate prefix (override with PREFIX)"
47-
@echo " clean Remove build artifacts"
27+
@echo " build Configure and build the C++ src in src/"
28+
@echo " run Build and run locally (set ARGS=\"./path\")"
29+
@echo " install Install to PREFIX/bin (default: /usr/local/bin)"
30+
@echo " clean Remove the CMake build directory"
4831
@echo " help Show this message"
4932
@echo
50-
@echo "Vars: ZIG, OPT (Debug/ReleaseSafe/ReleaseFast/ReleaseSmall), WINDOWS_TARGET, PREFIX"
33+
@echo "Vars: CMAKE, BUILD_DIR, CMAKE_BUILD_TYPE, PREFIX, ARGS"

README.md

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
# Zippy: A file-watching CLI for faster editbuildrun loops
1+
# Zippy: A file-watching CLI for faster edit-build-run loops
22

3-
Zippy is a lightweight CLI that watches a file or directory and reruns your command the moment you save. It keeps your stdout clean, logs to stderr with levels, and stays out of your way during the edit–build–run loop.
3+
Zippy is a lightweight Linux CLI that watches a file or directory and reruns your command the moment you save. It’s ideal for C++ development, letting you see the impact of your changes immediately without waiting for a full build.
44

55
## Quick start
66

77
```bash
8-
# Run from source (Linux/Arch):
8+
# Build from source
99
make build
10-
zig build run -- path/to/file-or-dir
10+
11+
# Run from the local build
12+
./src/build/zippy ./path/to/file-or-dir
1113

1214
# Install it globally
13-
sudo make install # /usr/local on Linux | %LOCALAPPDATA%/Programs/zippy on Windows
14-
sudo make install PREFIX=$HOME/.local # user-local
15+
sudo make install
16+
17+
# Or install for your user only
18+
make install PREFIX=$HOME/.local
1519

16-
# Run zippy!
20+
# Run zippy after install
1721
zippy ./path
1822
```
1923

@@ -26,50 +30,52 @@ Zippy loads `Zippy.json` from the current working directory:
2630
"delay": 1000000,
2731
"ignore": [],
2832
"save_log": false,
33+
"log_path": "zippy.log",
2934
"cmd": "make && ./build/out"
30-
// OR
31-
"cmd": "node index.js"
3235
}
3336
```
3437

35-
- `delay` (microseconds): debounce between change checks (default: 1_000_000).
36-
- `ignore`: reserved for future ignore patterns.
37-
- `cmd`: command to execute when changes occur. Placeholders: `{file}` (changed file or watched dir), `{dir}` (watched directory).
38-
- `save_log` (bool): when true, also write logs to `log_path` (default: `false`).
39-
- `log_path` (string): path to the log file when `save_log` is true (default: `zippy.log`).
40-
When `save_log=true`, child command stdout/stderr is tee’d into the same log.
38+
- `delay` (microseconds): debounce between checks. Default: `1000000`.
39+
- `ignore`: parsed for compatibility and future use; currently not applied.
40+
- `cmd`: command to run when a change is detected. Placeholders: `{file}` and `{dir}`.
41+
- `save_log`: when `true`, append Zippy logs and child output to `log_path`.
42+
- `log_path`: log file path used when `save_log=true`. Default: `zippy.log`.
4143

42-
Generate a starter config: `zippy --generate`.
44+
Generate a starter config with `zippy --generate`.
4345

4446
## CLI commands
4547

4648
- `--help` show help
4749
- `--version` print version
48-
- `--commands` list commands
49-
- `--config` show config help
50-
- `--log` print the configured log file (when `save_log=true`; includes child output)
51-
- `--clear` truncate the configured log file (when `save_log=true`)
50+
- `--config` print the active config summary
51+
- `--log` print the configured log file when `save_log=true`
52+
- `--clear` truncate the configured log file when `save_log=true`
5253
- `--credits` show credits
5354
- `--generate` write `Zippy.json`
5455

5556
## Example session
5657

5758
```text
58-
2026-02-06 16:22:11.104 [INFO] Zippy Starting Zippy v1.3.0
59-
2026-02-06 16:22:11.105 [INFO] Zippy Watching: /home/user/project/src
60-
2026-02-06 16:22:13.412 [INFO] Zippy Running: make && ./build/out
61-
2026-02-06 16:22:17.998 [WARN] Zippy File changed; re-running command
59+
2026-03-11 12:45:28.038 [INFO] zippy Starting Zippy v1.3.0
60+
2026-03-11 12:45:28.039 [INFO] zippy Watching file: /home/user/project/src/main.cpp
61+
2026-03-11 12:45:29.201 [INFO] zippy Running: make && ./build/out
62+
2026-03-11 12:45:33.812 [WARN] zippy File changed; re-running command...
6263
Your program output here...
6364
```
6465

65-
## Build & install
66+
## Build and install
67+
68+
Prereqs:
69+
70+
- CMake 3.16+
71+
- A C++20 compiler such as GCC or Clang
72+
- Linux or a Linux-compatible environment
73+
74+
Commands:
6675

67-
Prereqs: Zig 0.15.2+
76+
- `make build` configures and builds `src/`
77+
- `make run ARGS="./path"` runs the local build
78+
- `make install PREFIX=/path` installs `zippy` into `PREFIX/bin`
79+
- `make clean` removes the CMake build directory
6880

69-
- Linux/Arch (native):
70-
- `make build`
71-
- `sudo make install` (defaults to `/usr/local`; override with `PREFIX=/path`)
72-
- Windows cross (from Linux host):
73-
- `make build-windows`
74-
- `make install PREFIX="$LOCALAPPDATA/Programs/zippy"`
75-
- Add `$(PREFIX)/bin` to your `PATH` if it isn’t already.
81+
After install, ensure `PREFIX/bin` is on your `PATH`.

build.zig

Lines changed: 0 additions & 28 deletions
This file was deleted.

build.zig.zon

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)