Skip to content

Add fastfetch binary: system information fetcher#69

Merged
jiacai2050 merged 8 commits intomainfrom
copilot/port-fastfetch
Mar 16, 2026
Merged

Add fastfetch binary: system information fetcher#69
jiacai2050 merged 8 commits intomainfrom
copilot/port-fastfetch

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 16, 2026

Ports the fastfetch concept to Zig as a new fastfetch CLI binary in the toolkit.

What it shows

user@hostname
──────────────
OS:     Ubuntu 22.04.3 LTS x86_64
Kernel: 5.15.0-91-generic
Uptime: 2 hours, 30 mins
Shell:  bash
CPU:    Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 5312 MiB / 15908 MiB

Implementation

  • src/bin/fastfetch.zig — new binary with platform-specific data collection:

    • Linux: pure Zig, reads /proc/uptime, /proc/cpuinfo, /proc/meminfo, /etc/os-release — no extra library needed
    • macOS: @cImport + linkLibC() for sysctl calls (kern.boottime, kern.osproductversion, machdep.cpu.brand_string, hw.memsize). The @cImport is guarded by a top-level comptime if (native_os == .macos) so Linux builds never touch those headers.
    • Windows: skipped (returns null from makeCompileStep)
  • build.zig — registers fastfetch in the binary list; adds linkLibC() for macOS; returns null on Windows

Tests

Unit tests for the two pure helper functions: formatUptime (all four time-scale branches) and parseKbLine (/proc/meminfo line parser).

Original prompt

This section details on the original issue you should resolve

<issue_title>Port fastfetch</issue_title>
<issue_description>### Describe this problem

https://github.com/fastfetch-cli/fastfetch

Version

NA</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI and others added 2 commits March 16, 2026 07:38
Co-authored-by: jiacai2050 <3848910+jiacai2050@users.noreply.github.com>
Co-authored-by: jiacai2050 <3848910+jiacai2050@users.noreply.github.com>
Copilot AI changed the title [WIP] Add port for fastfetch Add fastfetch binary: system information fetcher Mar 16, 2026
Copilot AI requested a review from jiacai2050 March 16, 2026 07:44
@jiacai2050
Copy link
Copy Markdown
Owner

@copilot fix conflict.

…lot/port-fastfetch

# Conflicts:
#	build.zig
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 16, 2026

@copilot fix conflict.

Resolved in 0f0db40. build.zig now includes both "fastfetch" and "progress" in the binary list, with each binary's makeCompileStep entry preserved.

@jiacai2050 jiacai2050 marked this pull request as ready for review March 16, 2026 11:41
Copilot AI review requested due to automatic review settings March 16, 2026 11:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new fastfetch CLI binary to the Zig toolkit to print basic system information (OS, kernel, uptime, shell, CPU, memory), with Linux /proc-based collection and macOS sysctl-based collection, and wires it into the build.

Changes:

  • Introduces src/bin/fastfetch.zig implementing the fastfetch command plus unit tests for formatUptime and parseKbLine.
  • Registers fastfetch in build.zig and conditionally links libc for macOS builds.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/bin/fastfetch.zig New fastfetch binary implementation + helper-function tests.
build.zig Adds fastfetch to the build and applies platform-specific build/link behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +248 to +255
} else if (std.mem.eql(u8, name, "fastfetch")) {
if (is_win) {
return null;
}
// macOS sysctl requires libc; Linux uses /proc and needs no extra library.
if (is_darwin) {
exe.linkLibC();
}
Expand fastfetch output with host model, disk usage, display resolution,
battery, and theme. Add cross-platform C imports and correct framework
linking on macOS. Improve CPU, memory, and uptime reporting to show more
details and handle both Linux and macOS OS-specific fields.

This change allows users to quickly view comprehensive hardware and OS
information, motivating the update to facilitate troubleshooting and
system inventory.
Introduce documentation for fastfetch, including usage examples, key
features, and output demonstration. This provides new and existing users
with a clear overview of fastfetch's capabilities and platform support,
enhancing accessibility and understanding without requiring inspection
of the source code.
Add "fastfetch" to the build blacklist to prevent compilation on
non-Darwin systems. This change ensures platform-specific targets are
handled consistently and avoids build errors caused by unsupported
executables.
Show monitor refresh rate in resolution info on macOS,
providing users a more accurate overview of display settings.
Improves UX for those needing detailed screen specs.
@jiacai2050 jiacai2050 force-pushed the copilot/port-fastfetch branch 2 times, most recently from 7892e70 to da5862b Compare March 16, 2026 13:06
@jiacai2050 jiacai2050 merged commit f668700 into main Mar 16, 2026
8 checks passed
@jiacai2050 jiacai2050 deleted the copilot/port-fastfetch branch March 16, 2026 13:08
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.

Port fastfetch

3 participants