{"id":16476414,"url":"https://github.com/softprops/zig-termsize","last_synced_at":"2025-08-30T20:07:19.259Z","repository":{"id":225075969,"uuid":"764997079","full_name":"softprops/zig-termsize","owner":"softprops","description":"terminal size matters","archived":false,"fork":false,"pushed_at":"2025-05-08T20:58:26.000Z","size":26,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-25T02:41:10.254Z","etag":null,"topics":["zig-library","zig-package","zigdex-lib"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softprops.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"softprops"}},"created_at":"2024-02-29T04:54:41.000Z","updated_at":"2025-08-22T00:36:07.000Z","dependencies_parsed_at":"2024-11-12T07:41:23.013Z","dependency_job_id":"7a2e2e25-fff9-4571-ae00-02e122a3f75a","html_url":"https://github.com/softprops/zig-termsize","commit_stats":null,"previous_names":["softprops/zig-termsize"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/softprops/zig-termsize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fzig-termsize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fzig-termsize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fzig-termsize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fzig-termsize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softprops","download_url":"https://codeload.github.com/softprops/zig-termsize/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fzig-termsize/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272900157,"owners_count":25012033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["zig-library","zig-package","zigdex-lib"],"created_at":"2024-10-11T12:42:24.752Z","updated_at":"2025-08-30T20:07:19.234Z","avatar_url":"https://github.com/softprops.png","language":"Zig","funding_links":["https://ko-fi.com/softprops"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    termsize\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n    terminal size matters\n\u003c/div\u003e\n\n---\n\n[![CI](https://github.com/softprops/zig-termsize/actions/workflows/ci.yml/badge.svg)](https://github.com/softprops/zig-termsize/actions/workflows/ci.yml) ![License Info](https://img.shields.io/github/license/softprops/zig-termsize) ![Release](https://img.shields.io/github/v/release/softprops/zig-termsize) ![Zig Support](https://img.shields.io/badge/zig-0.12.0%2F0.13.0-black?logo=zig)\n\n## 🍬 features\n\nTermsize is a zig library providing a multi-platform interface for resolving your terminal's current size in rows and columns. On most unix systems, this is similar invoking the stty(1) program, requesting the terminal size.\n\n## examples\n\n```zig\nconst std = @import(\"std\");\nconst termsize = @import(\"termsize\");\n\npub fn main() !void {\n    std.debug.print(\n        \"{any}\",\n        .{termsize.termSize(std.io.getStdOut())},\n    );\n}\n```\n\n## 📼 installing\n\nCreate a new exec project with `zig init-exe`. Copy the echo handler example above into `src/main.zig`\n\nCreate a `build.zig.zon` file to declare a dependency\n\n\u003e .zon short for \"zig object notation\" files are essentially zig structs. `build.zig.zon` is zigs native package manager convention for where to declare dependencies\n\nStarting in zig 0.12.0, you can use and should prefer\n\n```sh\nzig fetch --save \"git+https://github.com/softprops/zig-termsize#v0.1.0\"\n```\n\notherwise, to manually add it, do so as follows\n\n```diff\n.{\n    .name = \"my-app\",\n    .version = \"0.1.0\",\n    .dependencies = .{\n+        // 👇 declare dep properties\n+        .termsize = .{\n+            // 👇 uri to download\n+            .url = \"https://github.com/softprops/zig-termsize/archive/refs/tags/v0.1.0.tar.gz\",\n+            // 👇 hash verification\n+            .hash = \"{current-hash}\",\n+        },\n    },\n}\n```\n\n\u003e the hash below may vary. you can also depend any tag with `https://github.com/softprops/zig-termsize/archive/refs/tags/v{version}.tar.gz` or current main with `https://github.com/softprops/zig-termsize/archive/refs/heads/main/main.tar.gz`. to resolve a hash omit it and let zig tell you the expected value.\n\nAdd the following in your `build.zig` file\n\n```diff\nconst std = @import(\"std\");\n\npub fn build(b: *std.Build) void {\n    const target = b.standardTargetOptions(.{});\n\n    const optimize = b.standardOptimizeOption(.{});\n+    // 👇 de-reference termsize dep from build.zig.zon\n+    const termsize = b.dependency(\"termsize\", .{\n+        .target = target,\n+        .optimize = optimize,\n+    }).module(\"termsize\");\n    var exe = b.addExecutable(.{\n        .name = \"your-exe\",\n        .root_source_file = .{ .path = \"src/main.zig\" },\n        .target = target,\n        .optimize = optimize,\n    });\n+    // 👇 add the termsize module to executable\n+    exe.root_module.addImport(\"termsize\", termsize);\n\n    b.installArtifact(exe);\n}\n```\n\n## 🥹 for budding ziglings\n\nDoes this look interesting but you're new to zig and feel left out? No problem, zig is young so most us of our new are as well. Here are some resources to help get you up to speed on zig\n\n- [the official zig website](https://ziglang.org/)\n- [zig's one-page language documentation](https://ziglang.org/documentation/0.13.0/)\n- [ziglearn](https://ziglearn.org/)\n- [ziglings exercises](https://github.com/ratfactor/ziglings)\n\n\\- softprops 2024\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Fzig-termsize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftprops%2Fzig-termsize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Fzig-termsize/lists"}