Add Windows (Git Bash / MSYS2 / Cygwin) support for the system info block - #13
Open
AntaresGG wants to merge 1 commit into
Open
Add Windows (Git Bash / MSYS2 / Cygwin) support for the system info block#13AntaresGG wants to merge 1 commit into
AntaresGG wants to merge 1 commit into
Conversation
On MSYS-based bash, `uname -s` returns MINGW64_NT-* (or MSYS_NT-* / CYGWIN_NT-*), so neither the Darwin nor the Linux branch matched. The greeting rendered empty CPU, Memory, IP and Gateway fields, and printed `bash: uptime: command not found` on every new shell. - _rkt_hw_info: reuse the Linux /proc parsing — MSYS ships Linux-format /proc/cpuinfo and /proc/meminfo — and read the product name from the registry. ProductName still reads "Windows 10" on Windows 11, so it is corrected via CurrentBuild >= 22000. - _rkt_net_info: parse the default-route row of `route print -4 0.0.0.0`. That row is all numbers, so it survives the localized column headers that make `ipconfig` parsing unreliable on non-English Windows. - show_date_info: fall back to /proc/uptime when uptime(1) is missing. Every lookup degrades to the previous empty-string behaviour if the underlying tool is unavailable. The Darwin and Linux branches are untouched, and nothing here goes near the PRNG or the rendering path, so cross-shell palette parity is unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XABWp1UM9qhnQn8PvQnyN3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running the bash greeting under Git for Windows (Git Bash) leaves most of the Space Vessel block empty and prints an error on every new shell.
Before
After
Cause
_rkt_hw_infoand_rkt_net_infobranch onuname -sand only handleDarwinandLinux. Under MSYS-based bash that value isMINGW64_NT-10.0-26200(orMSYS_NT-*/CYGWIN_NT-*), so neither branch runs andcpu_str,mem_str,ipandgwstay empty. Separately, Git Bash ships nouptime(1), soshow_date_infowrites an error to the terminal and leaves the uptime blank.Changes
Three functions, one new
MINGW*|MSYS*|CYGWIN*branch each:_rkt_hw_info— MSYS exposes Linux-format/proc/cpuinfoand/proc/meminfo, so the CPU and memory parsing is the same as the Linux branch. The OS string comes fromreg queryonHKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion(a single call, three values). Note thatProductNamestill readsWindows 10 Enterpriseon Windows 11, so it is corrected viaCurrentBuild >= 22000._rkt_net_info— parses the default-route row ofroute print -4 0.0.0.0, which yields the gateway and the local interface address in one shot. I pickedrouteoveripconfigdeliberately: that row is entirely numeric, so it is immune to the localized labels that breakipconfigparsing on non-English Windows (this machine is a zh-CN install). When several default routes exist, the lowest-metric one wins.show_date_info— falls back to/proc/uptimewhenuptime(1)is absent, formatted as6 days, 8 hoursto match the shape of the existinguptimeoutput.Notes
DarwinandLinuxbranches are untouched; the new code is additive.PATH, so nothing can regress into an error message.bash/starcommand.shis changed. The zsh greeting has the same platform gap, but I have no MSYS zsh to verify against, so I left it alone. Happy to extend this tozsh/zsh_greeting.zshor to add a README/CHANGELOG note if you'd like.Testing
Verified on Windows 11 Enterprise 25H2 (build 26200), Git for Windows, bash 5.3.15, zh-CN system locale:
bash -n bash/starcommand.shpasses.rocket_hw_cache.sh(24 h) androcket_net_cache.sh(5 min) caches write and re-read correctly.star,star list,star color, andstar explorestill behave as before.🤖 Generated with Claude Code
https://claude.ai/code/session_01XABWp1UM9qhnQn8PvQnyN3