You are browsing as a guest. Sign up (or log in) to start making projects!

Hackfetch

  • 6 Devlogs
  • 13 Total hours

Customizable fetch for all Stardance Participants

Open comments for this post

2h 1m 10s logged

Live Hackfetch

New milestone today: hackfetch can now stay open and update itself while you code.

The goal was simple: run hackfetch once, leave it in the corner of your terminal, and watch the numbers move in real time as you work.

hackfetch -watch

Your today-hours tick up. Your top project changes when you switch repos. Your streak rolls over at midnight. All without running the command a second time.

The static render was already in place from the regular one-shot fetch. The new part was redrawing without scrolling.

That sounds simple. It is not.

In a terminal, every time you print something, it appends to the bottom of the screen. By default, refreshing the fetch would just print a second copy of itself underneath the first, then a third, then a fourth. Within a minute you’d have a wall of identical fetches scrolling away into the past.

The trick is ANSI escape codes. There’s a sequence that means “move the cursor up N lines” and one that means “clear the rest of the screen from here down.” Together they let you erase the previous fetch and redraw a new one in the same spot. Same screen, fresh data, no scroll.

Why every 30 seconds? Two reasons:

Hackatime aggregates heartbeats in 1-minute buckets internally, so polling faster than that doesn’t tell you anything new 30 seconds is fast enough to feel “live” without hammering the API for no reason

Ctrl+C to quit. Resizing the terminal doesn’t break it. Pair it with a gradient color scheme and the whole thing turns into a tiny dashboard for your coding session:

hackfetch -watch sunset

1

Loading discussion…

0
8
Open comments for this post

23m 30s logged

Hackfetch Installs Itself Anywhere

Hackfetch crossed another milestone today: you no longer need Go installed to use it. Or Homebrew. Or anything, really.

The goal was simple: one command, any Linux, any Mac, no prerequisites.

curl -fsSL https://raw.githubusercontent.com/xerneas3318/hackfetch/main/install.sh | sh

Run that on Ubuntu, Fedora, Alpine, Arch, openSUSE, whatever you have, and a few seconds later hackfetch is on your PATH.

Getting the basic installer working was the easy part. Detect your OS, detect your CPU architecture, grab the matching binary from GitHub Releases, drop it in /usr/local/bin. Standard installer stuff.

The harder problem was the script itself failing on some Linuxes.

I’d written the first version in Bash, with set -euo pipefail at the top and $'\033[1m' style escape sequences sprinkled through. Worked great on my Mac. Worked great on Ubuntu. Then I checked which shell Alpine Linux ships by default. Not Bash. The whole script would die on line one for anyone on a minimal container.

So I rewrote it in POSIX sh, which is the one shell every Unix system actually has. No Bash-isms, no fancy quoting, no pipefail. Smaller, dumber, way more portable.

Speaking Seven Package Managers

The next problem: the script needs curl and tar to do its job. If you don’t have them, normally you’d just be stuck.

Instead, the installer now detects your system’s package manager and installs the missing prereqs for you:

  • apt (Debian, Ubuntu)
  • dnf (Fedora, RHEL)
  • yum (CentOS, older RHEL)
  • pacman (Arch)
  • zypper (openSUSE)
  • apk (Alpine)
  • brew (macOS)

They all do the same thing. They all use different words for it. The installer knows all seven.

One line. Any Linux. No prereqs.

0

Loading discussion…

0
6
Open comments for this post

19m 10s logged

Hackfetch Meets Orpheus!

If you’ve been around Hack Club for more than five minutes, you know Orpheus. The little dinosaur shows up everywhere: stickers,
websites, T-shirts, hackathon merch.

Until today, he wasn’t in hackfetch. That’s been bugging me since v1.0.

The goal was simple: give Orpheus a spot in the logo lineup, the same way flag, bot, and rocket already have one.

hackfetch orpheus

Drawing him was the harder part.

Every logo in hackfetch has to fit inside a fixed width of 33 characters, otherwise the system info column next to it gets pushed off the screen. 33 characters is not a lot of room to draw a recognizable dinosaur, especially one with personality.

I tried him head-on first. It didn’t work. Round dinosaur faces in ASCII end up looking like blobs because you don’t have curves, only corners.

So I redrew him in profile. The result:

  • a snout sticking out to one side
  • one big eye (◉) that catches the light
  • a HACK CLUB body underneath
  • two tiny stubby legs at the bottom

Nine lines tall. No wasted rows.

He plays especially well with the gradient color schemes:

hackfetch orpheus -color forest
hackfetch orpheus -color sunset

Forest makes him look like he’s wandering through tall grass. Sunset gives him a “main character in the closing shot” vibe.

The mascot finally has a seat at the terminal.

Long overdue!

Also if any better artists want to have a crack at it, I’m super open to that, and I can credit you in my repo as a collaborator! THNX!

1

Loading discussion…

0
9
Open comments for this post

4h 44m 56s logged

Hackfetch Can Finally Fetch

Hackfetch crossed a pretty big milestone today: it actually fetches things.

The goal is simple: build a Neofetch-style dashboard for Hack Club.

Run a single command and get a snapshot of your machine alongside your Hack Club activity.

hackfetch

and instantly see information like:

  • OS
  • Hostname
  • Username
  • Shell
  • Terminal
  • Editor
  • Hackatime
  • stats

Getting the system information was the easy part. Go makes it straightforward to grab things like the current user, hostname, operating system, and environment variables.

The harder problem was rendering everything cleanly beside an ASCII logo.

Each logo has different dimensions and line lengths, so I ended up building a small layout engine that calculates the width of every logo row and pads it dynamically before printing the corresponding information. Without that, the text column slowly drifts into the logo and the entire fetch screen looks broken.

Hooking into Hackatime

The more interesting work was integrating with the Hackatime API.Hackfetch reads your API key from:

~/.wakatime.cfg

authenticates with Hackatime, and pulls fresh coding statistics every time you run the command.Right now it can display:

Today’s coding time
Weekly coding time
Current streak
Top project
Most-used language

No browser.

No dashboard.

Just a terminal command.

1

Loading discussion…

0
13
Open comments for this post

27m 3s logged

In honor of pride month, I have added a pride color scheme to my custom hackfetch. It is currently installable via brew. On macs, simply run:

brew install xerneas3318/tap/hackfetch

Currently working on better support for more operating systems. Follow and like to stay updated!

2

Loading discussion…

0
229
Open comments for this post

5h 6m 35s logged

Introducing hackfetch a tiny terminal fetch tool for hackatime. Run hackfetch and get your hours today, weekly total, streak, top project, and top language right in your terminal.

5 logos. 8 color schemes. mix and match:
hackfetch stardance rainbow

How it works: hackfetch reads your hackatime key from ~/.wakatime.cfg, fetches your Hackatime summaries and heartbeats, then renders your stats directly in the terminal.

0

Loading discussion…

0
34

Followers

Loading…