git-prompt-rs

As a way to learn Rust I decided to write a small git prompt. I use it everyday myself and I strive it to be an example of how fast something like this can be.

Goals

  • Fast: Rust’s excellent benchmarking tooling helps with that.
  • Read-only: Rust’s immutable by default helps me to create a read-only interface to the git-repository.
  • Cross-platform: Currently tested on Mac and Linux.
  • Shell agnostic: It’s a binary it runs everywhere.

Features

  • When counting the commit difference between the remote and the local clone it will default to the master on the remote if a branch with the same name is not found. The default is customizable.

  • It will make sure that the last character of the prompt is a space. Some shells break because of this.

Screencast

Posted in  project  CLI with :  rust  git  prompt