Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## Unreleased

### New Programs
- **pretty-csv**: Pretty-print CSV/TSV files as aligned tables
- Auto-fits table width to terminal, truncates with `…`
- Three border styles: `ascii`, `box`, `dos`
- Transpose mode (`-t`): show each record as vertical key-value block
- Column selection (`-c 1,3,5`): display only specific columns
- Row separators (`--row-separator`) and right-aligned selected columns (`-r 2,4`)
- Configurable delimiter, padding, and max input size

### Improvements
- **pretty-table**: `Table(N).Owned` runtime row helper with string shorthand and Cell-level control
- `Table(N)` and `Table(N).Owned`: optional transpose mode
- `RuntimeTable`: runtime column count with footer rows, header/footer cell setters, row separators, per-column alignment, `"{f}"` formatting, optional cell truncation, and UTF-8-safe truncation boundaries
- Windows targets skip POSIX terminal-width probing during cross-compilation
- **pretty-csv**: column filtering no longer truncates silently when CSV inputs exceed 256 columns

### Documentation
- Added `gitignore` package docs
- Updated `pretty-table` and `simargs` docs for Zig 0.15 API

## v0.4.0 (2026-03-18)

### New Programs
Expand Down
1 change: 1 addition & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ fn buildBinaries(
"tcp-proxy",
"timeout",
"cowsay",
"pretty-csv",
"zfetch",
"progress",
}) |name| {
Expand Down
3 changes: 2 additions & 1 deletion docs/content/install.org
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Then in your =build.zig=, import the module like this:
#+begin_src zig
const zigcli = b.dependency("zigcli", .{});

// Currently zigcli provide two packages.
// Currently zigcli provides three packages.
exe.root_module.addImport("simargs", zigcli.module("simargs"));
exe.root_module.addImport("pretty-table", zigcli.module("pretty-table"));
exe.root_module.addImport("gitignore", zigcli.module("gitignore"));
#+end_src
54 changes: 54 additions & 0 deletions docs/content/packages/gitignore.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#+TITLE: gitignore
#+DATE: 2026-03-20T08:45:00+0800
#+LASTMOD: 2026-03-20T08:45:00+0800
#+TYPE: docs
#+WEIGHT: 30
#+DESCRIPTION: Pure Zig .gitignore pattern matching — no libc dependency

* Features
- Full [[https://git-scm.com/docs/gitignore][.gitignore spec]] support: =*=, =?=, =[abc]=, =**/=, negation (=!=)
- Recursive =.gitignore= filtering via =GitignoreStack= (per-directory layers)
- Pure Zig implementation — no =libc= =fnmatch= dependency
- Last-match-wins semantics across all layers

* API

** =Gitignore=
Parse a single =.gitignore= file and match paths against it.

#+begin_src zig
const gitignore = @import("gitignore");

var gi = try gitignore.Gitignore.init(allocator, content);
defer gi.deinit();

if (gi.shouldIgnore("build/output.o", false)) {
// path is ignored
}
#+end_src

** =GitignoreStack=
Manage a stack of =.gitignore= layers for recursive directory walks.
Each layer is anchored to its directory, and patterns are evaluated with
correct relative paths.

#+begin_src zig
const gitignore = @import("gitignore");

var stack = gitignore.GitignoreStack.init();
defer stack.deinit(allocator);

// Push a layer when entering a directory.
const pushed = try stack.tryPushDir(dir, rel_dir, allocator);

if (stack.shouldIgnore(rel_path, is_dir)) {
// path is ignored
}

// Pop when leaving the directory.
if (pushed) stack.pop(allocator);
#+end_src

* Used by
- =tree=: Respects =.gitignore= when listing directory trees.
- =loc=: Skips ignored files when counting lines of code.
Loading
Loading