goprompt

module
v0.99.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: MIT

README

GoPrompt

CodeFactor

GoPrompt is a compact, two-line prompt for Zsh. It shows the current directory, Git state, user, optional SSH host, and local time without giving up the full width of the terminal.

GoPrompt showing the current directory, user, time, and date

Features

  • Shortens long working directories based on the terminal width.
  • Shows the current Git branch and marks dirty repositories with *.
  • Adds (push) or (pull) when the branch is ahead of or behind its remote.
  • Shows the hostname when the shell is running over SSH.
  • Fills the space between segments to match the terminal width.
  • Provides colored output, a local clock, and the current date.

Install

GoPrompt requires Go 1.19 or newer to install from source.

go install github.com/erniebrodeur/goprompt/cmd/goprompt@latest

Make sure Go's binary directory, normally $HOME/go/bin, is on your PATH.

Zsh integration

Add this to ~/.zshrc:

autoload -Uz add-zsh-hook

_goprompt_precmd() {
  PROMPT="$(goprompt)"
}

add-zsh-hook precmd _goprompt_precmd
_goprompt_precmd

Reload the configuration with source ~/.zshrc or open a new terminal.

Git is optional at runtime. Outside a repository, or when Git is unavailable, GoPrompt simply leaves out the Git segment.

Git indicators

Indicator Meaning
:main Current branch
:main* Working tree has changes
:main (push) Local branch is ahead of its remote
:main (pull) Local branch is behind its remote

CLI options

Option Description
-v, --version Print the installed version
-s, --status Print each prompt segment separately for diagnostics

Development

git clone https://github.com/erniebrodeur/goprompt.git
cd goprompt
go test ./...
go build -o goprompt ./cmd/goprompt

License

GoPrompt is available under the MIT License.

Directories

Path Synopsis
cmd
goprompt command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL