progress

progress
git clone git://brookjeynes.dev/bjeynes/progress.git
Log | Files | Refs | README | LICENSE

commit 7613937e679fe6422dddb7d6ad2bd6d78f050110
parent 47dc583fc49c7ecc230193144fb6473abbd2af3d
Author: BrookJeynes <jeynesbrook@gmail.com>
Date:   Wed, 26 Mar 2025 07:27:19 +1000

chore: Update project to Zig v0.14.0

Diffstat:
MREADME.md | 12++++++++----
Mbuild.zig.zon | 6+++---
Mexamples/bar/thread.zig | 2+-
Msrc/ansi-term.zig | 2+-
Msrc/termsize.zig | 9+++++----
5 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md @@ -1,10 +1,14 @@ # progress +![Demo of library](https://github.com/user-attachments/assets/227297c4-15a5-4c68-a8bc-49d7e1505a79) + A simple thread safe progress bar and spinner library. -![Recording](https://github.com/user-attachments/assets/227297c4-15a5-4c68-a8bc-49d7e1505a79) +- [Installation](#installation) +- [Example](#example) +- [Contributing](#contributing) -## Adding to your program +## Installation 1. Fetch the package. `zig fetch --save git+https://github.com/BrookJeynes/progress` 2. Add to your `build.zig`. @@ -13,7 +17,7 @@ A simple thread safe progress bar and spinner library. exe.root_module.addImport("progress", progress); ``` -## Minimal example +## Example ```zig const std = @import("std"); const ProgressBar = @import("progress").Bar; @@ -54,4 +58,4 @@ For more information, see the source code or documentation (`zig build docs`). ## Contributing Contributions, issues, and feature requests are always welcome! This project is -using the latest stable release of Zig (0.13.0). +using the latest stable release of Zig (0.14.0). diff --git a/build.zig.zon b/build.zig.zon @@ -1,8 +1,8 @@ .{ - .name = "progress", + .name = .progress, .version = "1.2.0", - - .minimum_zig_version = "0.13.0", + .fingerprint = 0x2201f246209e1a21, + .minimum_zig_version = "0.14.0", .dependencies = .{}, diff --git a/examples/bar/thread.zig b/examples/bar/thread.zig @@ -2,7 +2,7 @@ const std = @import("std"); const ProgressBar = @import("progress").Bar; pub fn threadWorker(bar: *ProgressBar, seed: usize) !void { - var rand_impl = std.rand.DefaultPrng.init(seed); + var rand_impl = std.Random.DefaultPrng.init(seed); const num = @mod(rand_impl.random().int(u64), 1000); for (0..5) |_| { diff --git a/src/ansi-term.zig b/src/ansi-term.zig @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // -// https://github.com/ziglibs/ansi-term +// Repo: https://github.com/ziglibs/ansi-term const std = @import("std"); diff --git a/src/termsize.zig b/src/termsize.zig @@ -19,7 +19,8 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -// https://github.com/softprops/zig-termsize +// Repo: https://github.com/softprops/zig-termsize +// Modifications made by Brook Jeynes (https://github.com/brookjeynes) const std = @import("std"); const builtin = @import("builtin"); @@ -68,7 +69,7 @@ pub fn termSize(file: std.fs.File) !?TermSize { }; }, .linux, .macos => blk: { - var buf: std.posix.system.winsize = undefined; + var buf: std.posix.winsize = undefined; break :blk switch (std.posix.errno( std.posix.system.ioctl( file.handle, @@ -77,8 +78,8 @@ pub fn termSize(file: std.fs.File) !?TermSize { ), )) { .SUCCESS => TermSize{ - .width = buf.ws_col, - .height = buf.ws_row, + .width = buf.col, + .height = buf.row, }, else => error.IoctlError, };