
GoPS
The goal of GoPS to offer a fast powerline-like prompt.

Installation
There are two approaches of getting GoPS: Using a release or building it from source.
Using a release
GoPS relies on modded fonts (namely powerline-fonts) to display some of the symbols. Make sure to install it and activate it for your terminal: https://github.com/powerline/fonts#installation
Click on "release" and download the newest binary for your OS. Place it in a folder which is in $PATH
.
Building from source
GoPS relies on modded fonts (namely powerline-fonts) to display some of the symbols. Make sure to install it and activate it for your terminal: https://github.com/powerline/fonts#installation
Make sure the current Go version is installed. If not, refer to this guide: https://golang.org/doc/install#install
Also make sure your $GOPATH/bin
directory is in the $PATH
.
Now you can install GoPS by running
go get -u github.com/noxer/gops
Setup
bash
After the downloading and building of GoPS is complete, add it as your prompt. For Bash edit ~/.bashrc
and add the following lines
PS1='$(gops)'
PS2='$(gops -p 2)'
The first line activates GoPS as your default prompt, the second line for continuation prompts (when the command ends with \
it will print a continuation prompt to the next line).
To apply the change, you need to either close your shell and open it again or source the updated .bashrc
file as follows:
source ~/.bashrc
zsh
After the downloading and building of GoPS is complete, add it as your prompt. For ZSH edit ~/.zshrc
and add the following lines
setopt PROMPT_SUBST
PROMPT='$(gops -s zsh)'
The first line tells ZSH to evaluate the commands in the $PROMPT
variable. The second line calls GoPS.
To apply the change, you need to either close your shell and open it again or source the updated .zshrc
file as follows:
source ~/.zshrc
FAQ
(Questions that have never been asked but I think the answers may help you)
You don't. Right now GoPS does not support any config files or command line parameters. Instead you can edit main.go
or the segments themselfs to adapt the prompt to your needs.
I've successfully built and activated GoPS but it prints strange characters in the prompt. How do I fix that?
You've either not installed powerline-fonts
or it is not configured to be used in your terminal. Make sure you've installed it from here and you've activated one of the fonts. The font used for the screenshot is Source Code Pro for Powerline
.
I found a bug, how do I report it?
Open an issue in this repository. Make sure you include information about the used operating system and terminal.
Does GoPS support shell XYZ?
No idea. I've tested it with bash
in a GNOME-Terminal, and zsh
in iTerm2. Feel free to try more combinations and let me know.
How do I write plugins for GoPS?
That is pretty easy. There is an example.go
file in the segments/
folder with a skeleton for a segment. You basically add as many segments as you wish to the provided list of segments and return it. Make sure you add your custom package to import list of the main.go
file and call your Add
function in the main
function. Each segment defines a foreground and background color. If two consecutive segments have the same background color, a small separator in the foreground color is added, otherwise the full separator is inserted.
API
You can find the packages rendering the different parts here:
- Common Segments:

- Separator:

- Symbols:
