TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Zig's new CLI progress bar explained

122 点作者 fmystic12 个月前

10 条评论

lionkor12 个月前
I really enjoy reading Zig, I always struggle writing it because its so subtly different from the other languages I use, like C, Rust and Go, that I get confused often.<p>I really hope Zig becomes stable soon so I can use it on non-throwaway projects
评论 #40549879 未加载
评论 #40548939 未加载
评论 #40549122 未加载
评论 #40549042 未加载
Groxx12 个月前
I wish all multi-task systems had a UI like this. It makes it SO much easier to spot where your biggest latencies are coming from, which is an excellent passive motivator to improve them.<p>Silent &#x2F; opaque progress just teaches people that they can&#x27;t do anything about it except wait, so all it does is get worse and worse.
评论 #40551179 未加载
Filligree12 个月前
&gt; The key insight I had here is that, since the end result must be displayed on a terminal screen, there is a reasonably small upper bound on how much memory is required, beyond which point the extra memory couldn&#x27;t be utilized because it wouldn&#x27;t fit on the terminal screen anyway.<p>How large are your terminals?<p>I&#x27;m not sure if this represents lines, or perhaps something else. But on occasion I need to copy things out of my terminal, scrolling while copying doesn&#x27;t work well, and so I shrink the text size to, let&#x27;s say, one or two pixels per letter. I suspect Zig won&#x27;t survive this.
评论 #40550472 未加载
ximeng12 个月前
The visualisation is really neat.<p>Would be interesting to have a mechanism to track runtime of each step and compare across runs (maybe with a unique generated key?), so that you could benchmark speed up and slow down. This would enable per time rather than per step progress bars.
one-punch12 个月前
Reminds me of nix-output-monitor [1], for example see [2].<p>It makes it easy to understand how individual steps are progressing, and how individual steps relate to the overall plan. It enables me to locate expensive build steps, and possibly to avoid them if steps are failing.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;maralorn&#x2F;nix-output-monitor">https:&#x2F;&#x2F;github.com&#x2F;maralorn&#x2F;nix-output-monitor</a><p>[2]: <a href="https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;7hJXH2iFLEkKxG1lL25lspqNn" rel="nofollow">https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;7hJXH2iFLEkKxG1lL25lspqNn</a>
ai_12 个月前
I&#x27;m not sure if it&#x27;s actually any easier to read. When lots of things are changing it honestly becomes harder to read and figure out what&#x27;s important and what&#x27;s superfluous.<p>With the old progress system, everything was on one line. This honestly isn&#x27;t horrible to me since I can easily glance text from left to right to figure out what the gist of the text is. When it&#x27;s changing between the same two steps it still isn&#x27;t too much of an issue since the information is all still in the same place and it&#x27;s not actually changing too much between each stage. I can identify each step, figure out what&#x27;s changing between them, and look for that information specifically.<p>The new progress system dumps <i>a lot</i> more information at the user, most of it detailing what file is being analyzed and compiled, each one taking maybe 2-4 frames of screen time, on an excessive number of lines, just a complete barrage of pointless information. None of this is really important to me since the only time it would be important is if a file or step took more than 3 seconds to be processed. With items constantly appearing and disappearing, the things that are taking time on the more macro scale like build-lib and build-exe steps that are more important to me will constantly move around the terminal. It&#x27;s much much harder to read something if it&#x27;s jumping up and down randomly every 2 frames vs if it&#x27;s being swapped to share a single line. If the line literally leaves my field of view, it becomes frustrating to follow.<p>I much prefer the Bazel approach to this problem. When running a series of actions concurrently, the 6 actions taking the most amount of time will be visible in the action list showing how long they&#x27;re taking, but all other actions will be minimized to a &quot;and X other actions...&quot; line.<p>This looks cool on the surface, but in practice is not that good at giving you progress information. Which is what progress indicators should do! At best this is a better indicator of how much work is being done, not how much progress is being made. Like a bunch of bleeps, bloops, and random LEDs toggling when a computer does work in a sci-fi TV show.<p>I think this would be better if individual files being processed got removed unless they start taking too long. Keep the build-exe and build-lib steps around but make them a little sticky. When they complete, have it say &quot;Done&quot; and then remove things in groups or on a set interval. Don&#x27;t change the number of lines too often and don&#x27;t reorganize lines either. Generally, it should be easy to parse what&#x27;s going on and frequent changes to the number of lines and how much information is on each makes that hard.
评论 #40549651 未加载
epage12 个月前
I&#x27;ve seen guides for detecting terminal support for colors, hyperlinks, emoji, etc but not &quot;fancy&quot; terminal control like this. Anyone know of any? In one CLI I work on, some others are concerned about the long tail of users and wanting to make sure no one has a bad experience by default.
评论 #40550008 未加载
Animats12 个月前
Not sure if this is a joke.
binary13212 个月前
One thing that the latest generation of languages has taught me (or that I have learned in the process?) is that “languages” aren’t “really a real thing” in and of themselves as much as they are merely composable APIs over compilers &#x2F; interpreters (which are basically just dynamic compilers, or compilers are interpreters?), and compilers are an insane, fragmented dumpster fire with no or barely usable APIs. Only LLVM, GCC, TinyCC, and Terra admit this reality, neither LLVM nor GCC’s APIs are really user-oriented, and Terra isn’t really a realistic option for most people. I also personally don’t really feel that LLVM has accomplished (or can accomplish) its potential for a variety of reasons — most LLVM projects are forks or patches, although Zig has done well at this — and GCC has limitations as well although I’m very pleased with gccjit in Emacs. I’m very curious to see what the future holds especially if we can get an optionally-verifiable yet usable compiler API.
thefaux12 个月前
Unsolicited writing advice: drop the self-aggrandizing grandiosity. It is distracting and undermines the work itself.<p>Zig is a language for writing perfect programs? The fact that a progress bar is needed at all is a symptom of the lack of perfection of Zig. A perfect compiler would compile instantly (or at least faster than human perception is capable of registering) with no need for a progress bar.
评论 #40548339 未加载
评论 #40528614 未加载
评论 #40574189 未加载
评论 #40540041 未加载
评论 #40542280 未加载