Skip to content

Add demos and refactor config initialization - #42

Merged
Boomatang merged 2 commits into
mainfrom
dev
Jul 3, 2026
Merged

Add demos and refactor config initialization#42
Boomatang merged 2 commits into
mainfrom
dev

Conversation

@Boomatang

Copy link
Copy Markdown
Owner

Summary

  • Add demo documentation and asciinema recordings for the get and diff commands, including step-by-step guides and sample Kubernetes manifests for the diff demo
  • Refactor get and snapshot command config initialization to construct config structs inline instead of using separate mutable variables and conditional assignments
  • Extract the snapshot default delay value into a named constant (DefaultDelay) in types.zig
  • Fix a resource leak in snapshot.zig where defer resource.deinit() was placed before an early continue that would skip the deinit on excluded resources
  • Remove docs/ from .gitignore so demo documentation is tracked in version control

Details

The refactor commit simplifies how CLI arguments are mapped to config structs. Previously, get.zig declared several mutable local variables, conditionally assigned each from parsed args, then built the config struct from those locals. The new approach constructs the Config struct directly using inline if expressions on the parsed args, eliminating the intermediate variables. The same pattern is applied to SnapshotConfig initialization in snapshot.zig, where delay, limit, and count were previously set via post-construction mutation.

A subtle bug fix is included in snapshot.zig: the defer resource.deinit(gpa) was moved after the exclude check. Previously, when a resource matched an exclude pattern and hit continue, the explicit resource.deinit(gpa) in the exclude branch would free it, and then the defer would fire again at loop iteration end, causing a double-free. Moving the defer after the exclude check ensures it only activates for resources that proceed past the exclusion logic.

The demo commit adds documentation with embedded asciinema recordings showing real usage of the tool against KinD clusters. The diff demo includes Kuadrant Kubernetes manifests (HTTPRoute, RateLimitPolicy, Kuadrant CR) and a kustomization file to demonstrate how kubectlgetall diff reveals cluster changes.

Signed-off-by: Jim Fitzpatrick <jfitzpat@redhat.com>
Some short demos show how to use the diff and get commands.

Signed-off-by: Jim Fitzpatrick <jfitzpat@redhat.com>
@Boomatang
Boomatang merged commit 595c7ac into main Jul 3, 2026
2 checks passed
@Boomatang
Boomatang deleted the dev branch July 3, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant