Open-source project
justjanne/powerline-go avatar
justjanne/powerline-go

powerline-go: a Go prompt for Bash, ZSH and Fish that reads your repo state

A beautiful and useful low-latency prompt for your shell, written in go

2,893 stars283 forksGoGPL-3.0

At a glance

What is it?
powerline-go renders a Powerline-style shell prompt from a single Go binary, showing git and hg branch state, exit codes, virtualenvs and more. It is fast to install and easy to wire into zsh, but the README documents little beyond setup.
Who is it for?
Adopt powerline-go if you want a fast, single-binary Powerline prompt in bash, zsh or fish and you are comfortable editing your shell init file by hand. Skip it if you need right-side prompt support in bash (the README states it is unavailable there), if you refuse to install a patched font for the default mode, or if you want a prompt that is configured from a documented config file rather than command-line flags.
Can I use it commercially?
Yes, with conditions. GPL-3.0 is a copyleft licence: if you distribute software that includes it, you must release that software's source code under the same licence. Running it internally without distributing it does not trigger that obligation.
Is it still maintained?
Yes. The repository last received commits 51 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 26, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What powerline-go replaces in your shell prompt

A default shell prompt tells you almost nothing. powerline-go renders a segmented prompt that answers the questions you ask dozens of times a day: which branch am I on, does it have uncommitted changes, how far ahead or behind the remote am I, and did the last command fail. The README lists what it displays: the git or hg branch, a color change when the previous command exited non-zero, a shortened path when you are deep in a directory tree, the active Python virtualenv, the Ruby version from rbenv or rvm, and whether you are inside a nix shell.

It is aimed at developers who already know they want a Powerline-style prompt and are choosing an implementation. The project is a Go port of Powerline-Shell by @banga, and the README credits that lineage directly. Because it is a compiled binary rather than a Python script, the prompt is rendered by a single process invocation per prompt draw instead of an interpreter startup, which is the low-latency claim in the project description.

The audience is narrower than "everyone who uses a terminal". If you never touch git or hg from the command line, most of the value disappears. If you do, the branch segment alone earns its place.

How the prompt is assembled: one binary, one invocation per draw

powerline-go is not a daemon. Your shell calls the binary each time it draws a prompt, and the binary prints the prompt string to standard output. In the bash snippet the README gives, PROMPT_COMMAND calls a function that assigns PS1 to the output of the binary. In zsh, a precmd function does the same for PS1. In fish, fish_prompt is redefined to eval the binary's output.

The binary receives context as command-line arguments: -error $? passes the exit status of the last command, and -jobs passes a job count. The README's zsh example uses ${${(%):%j}:-0} for the job count; the bash example uses $(jobs -p | wc -l). Everything else the prompt shows, the binary works out itself from the environment and the filesystem.

That design is visible in the repository layout. Each display element has its own source file: segment-git.go, segment-hg.go, segment-cwd.go, segment-exitcode.go, segment-kube.go, segment-docker.go, segment-node.go and roughly thirty others sit at the top level of the repository. main.go and powerline.go tie them together, and config.go with defaults.go handle flags and defaults. The dependency list in go.mod is small: go-runewidth for display width, gopsutil for system information, x/sys and x/term for terminal handling, x/text, plus ini and yaml parsers. A small dependency set matters here because the binary runs on every prompt draw.

Because each segment is a separate file, adding a segment means adding a file rather than editing a monolith. The README also mentions a plugin mechanism, though it does not document how to write one.

Installing powerline-go and getting a first prompt in zsh

The README states the project requires Go 1.15 or newer. Precompiled binaries for x64 Linux and macOS are provided in the releases tab. On other platforms, the documented install is a single go install command, which places the binary in $GOPATH/bin by default.

bash
go install github.com/justjanne/powerline-go@latest

After that, add a precmd function to your .zshrc. The README's zsh snippet assigns PS1 from the binary's output, passing the exit status and job count. The install_powerline_precmd function guards against adding the hook twice:

bash
function powerline_precmd() {
    PS1="$($GOPATH/bin/powerline-go -error $? -jobs ${${(%):%j}:-0})"
}

If your $GOPATH differs, change the path in the snippet. The README notes that if you set $GOPATH or $GOBIN, you must also change the path in the shell scripts.

One prerequisite is easy to miss. The default "patched" mode needs a powerline font installed, either as a fallback or by patching your terminal font. Without it the separator glyphs will not render correctly. The README points to powerline-fonts for this. If you would rather not install a font, the README says you can use "compatible" or "flat" mode instead. The README also notes that powerline-go uses ANSI color codes and that you may need to set $TERM to xterm-256color.

To see what you can change, run the binary with -help. The README shows the usage output, which includes flags such as -cwd-max-depth (default 5), -cwd-max-dir-size (default -1), -cwd-mode with valid choices fancy, semifancy, plain and dironly (default fancy), -condensed to remove spacing between segments, -colorize-hostname, and -duration for the elapsed clock-time of the previous command. Adjust the command in your init file to pass whichever flags you want.

Where powerline-go stops being the right choice

Three limits stand out from the README itself, before you get to anything about the project's style of configuration.

First, bash has no right prompt. The README states plainly that right prompt support is not available when using bash. If your layout depends on a right-aligned block for time, hostname or load, bash is the wrong shell for this prompt and you would need zsh or fish.

Second, the font requirement is not optional in the default mode. Patched mode is described as the default and as providing improved UI. You either install a powerline font or you switch to compatible or flat mode. That is a real setup cost on machines you do not control, and it is the reason a first-time user may see broken glyphs and conclude the tool is faulty.

Third, the nix-shell case has a documented failure mode. The README says that when using nix-shell --pure, powerline-go will not be accessible and your prompt will disappear. The workaround it gives is a .bashrc snippet that aliases powerline-go to $HOME/.nix-profile/bin/powerline-go or /run/current-system/sw/bin/powerline-go when $IN_NIX_SHELL is pure. The README hedges that this should re-enable the prompt "in most cases". Note the shape of the problem: the prompt is a separate executable, so any environment that hides that executable from PATH takes the prompt with it. A prompt built into the shell itself does not have that failure mode.

Configuration is the quieter limitation. The README documents flags and points at powerline-go -help for the full list, but it does not present a configuration file format, a theme definition, or a rollback procedure if a prompt change breaks your shell. If you want to tune appearance beyond the documented flags, the README is not the place that explains how.

powerline-go versus starship and other prompt generators

The closest comparison people search for is starship. Both are single binaries that render a prompt by being invoked from your shell, and both show git state. The difference is in configuration model and scope. powerline-go is configured entirely through command-line flags that you repeat in your shell init file; the README's customization section is a pointer to powerline-go -help. Starship's approach is a TOML configuration file, which is a different trade-off: more to learn up front, but a single file to edit, copy between machines and version-control instead of a growing argument list in .zshrc.

A second difference is visual lineage. powerline-go is explicitly a Powerline-style prompt and inherits the Powerline separator and font conventions, which is why the patched font is needed by default. If you want that specific look, this is the point of the project. If you do not care about Powerline separators, you are paying the font cost for a style you did not ask for, and compatible or flat mode removes the visual reason to pick it.

A third is scope of segments. The repository files show segments for AWS, Azure, GCP, Kubernetes, Docker, Terraform workspace, direnv, dotenv, nix-shell, node, goenv, rbenv, rvm, perlbrew, plenv, shenv, vgo and several version control systems. That is a broad set for a prompt that is configured by flags rather than a plugin config file. If your stack is represented in that file list, the coverage is there.

Licence and the cost of keeping it current

powerline-go is licensed under GPL-3.0, and the repository carries a LICENSE.md. That matters more than it does for most developer tools because of how this one is used. You are not linking a library into your application; you are running a binary from your shell. But if you fork the project, ship a modified binary inside a product image, or bundle it into a distribution, the GPL-3.0 obligations attach to that distribution. This is a description of the licence identifier, not legal advice; if you plan to redistribute a modified build, read LICENSE.md and get your own answer.

Upgrade cost is low but not zero. The last push to the repository was on 2026-08-11, and the most recent release is v1.26 from 2026-01-14. The gap between those two dates is worth noticing: the repository has moved since the last tagged release, so installing from source with go install github.com/justjanne/powerline-go@latest gives you code that is newer than the v1.26 tag, and newer than whatever version a distribution package manager ships. The README's own note that you must change the path in your shell scripts if you move the binary is the main upgrade hazard: the path is hardcoded in .bashrc, .zshrc or config.fish, so a change in install location silently produces an empty prompt rather than an error.

There is no documented migration path between versions in the README. Flags have defaults, and the usage output in the README shows those defaults, but the README does not state when a flag was added or removed. If you depend on a flag, verify it exists in the version you actually installed by running powerline-go -help before you rely on it.

Editorial conclusion

Adopt powerline-go if you want a fast, single-binary Powerline prompt in bash, zsh or fish and you are comfortable editing your shell init file by hand. Skip it if you need right-side prompt support in bash (the README states it is unavailable there), if you refuse to install a patched font for the default mode, or if you want a prompt that is configured from a documented config file rather than command-line flags. Before wiring it in, run powerline-go -help and confirm which flags your installed version supports, then check that the version in your package manager is recent enough to include them.

Frequently asked questions

How do I install a Powerline font?

The README says you need to install a powerline font, either as a fallback or by patching the font you use for your terminal, and points to powerline-fonts for this. If you would rather not install one, you can use compatible or flat mode instead.

Is powerline-go good?

The README describes it as a Powerline-like prompt for Bash, ZSH and Fish that shows git or hg branch state, changes color when the last command failed, shortens deep paths, and shows virtualenv, Ruby version and nix shell status. Whether that set of segments matches your workflow is the deciding factor, since the project is configured through flags rather than a config file.

Is powerline-go good for gaming?

The README describes powerline-go as a shell prompt for Bash, ZSH and Fish, and lists segments for version control branches, virtualenvs, Ruby versions, nix shells and similar developer state. It does not mention gaming or any use outside the shell prompt.

Official sources

  1. Issues
  2. justjanne/powerline-go on GitHub
  3. License: GPL-3.0
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/justjanne-powerline-go.svg)](https://hysenlabs.com/projects/justjanne-powerline-go)