tl;dr: D port of powerline-shell, a beautiful command prompt with (among others) git status https://github.com/FeepingCreature/powerline-d
What's powerline-shell?
Has this happened to you? You're using git, and you enter some command only to get a weird error about branches. About fifteen minutes later, you finally realize you were in the middle of a rebase.
Wouldn't it be cool if your bash prompt automatically showed the status of the git repository in the current folder? Whether it's clean, whether you forgot to add any files, what branch you're on etc?
Enter powerline-shell. It's a Python tool that is executed on every prompt render and adds a bunch of information, such as host, git status, and a whole bunch of other configurable widgets. I consider it plainly indispensable for commandline git use.
Anyway, so a few days ago I noticed that powerline-shell was slow. Like, observable slowdown every time I hit return slow. It's kind of unavoidable, it's a Python project, it has to load the interpreter every time it starts.
Now there's a few rewrites, one in Rust, one in Go, but I mean - we're a D shop, and I'll be damned if I make critical workflow dependent on a Rust tool. But hey, the source isn't that big - only 2116 lines spread over 43 files. 61KB of source code. That comfortably fits in the context window of Claude 3.5 Sonnet. So I thought - what's to it? Let's just throw it in there and see how it handles things.
powerline-d
And what do you know, three hours and a long dialog later and seven bucks poorer, we have https://github.com/FeepingCreature/powerline-d . Anyone who says large language models aren't really intelligent now has to argue that programming doesn't require intelligence. At an estimate, this is 99.9% the AI's work, all I had to do was provide some design ideas and fix some syntax errors. And it definitely runs a lot faster than powerline-shell.
How much faster?
$ time powerline-shell
...
real 0m0,266s
$ time powerline-d --shell bash
...
real 0m0,072s
I'd say that's pretty meaningful. A lot of the speedup comes from me asking the AI to get rid of manual process calls to ps
and git
in favor of walking /proc
or linking libgit2
directly, but even before that it was about twice as fast, just from skipping the Python interpreter setup/teardown.
I'm using it everywhere now instead of powerline-shell, and it works fine, which is to say indistinguishable from the original except the weird noticeable delay on hitting return is gone. I'd say it's a win.
A warning
I do have to say this. I've tested the parts of this that I personally use, but there were some problems in there. However, widgets like hg
support are totally untested, because I don't personally need them. It's in there, and it builds, but I have no clue what'll happen if someone tries to use it. Bug reports welcome!