#display #git #prompt #info #process #cli #information

app dev_info

A simple utility to display git related info in a CLI prompt

1 unstable release

Uses old Rust 2015

0.1.0 Jul 18, 2018

#166 in #prompt

MIT license

10KB
175 lines

dev_info

dev_info is a simple command line utility that can display informations related to the current git directory. Contrary to other alternatives, it is quite fast because it relies on libgit2 to directly obtain repository information without spawning other processes.

Installation

First run:

cargo install dev_info

Then add it to your PROMPT or PS1 (this depends on your shell). For zsh I have the following:

setopt PROMPT_SUBST
PROMPT='[%{%F{red}%}%n%{%f%}@%{%F{red}%}%m%{%f%}]%{%F{blue}%}%~%{%f%} $(dev_info -b -c 7 -s) %# '

For bash you can look there: https://wiki.archlinux.org/index.php/Bash/Prompt_customization#Embedding_commands

Options

Currently the available options are limited:

Usage: dev_info [options]

Options:
    -h, --help          print this help menu
    -C, --color SCHEME  render using a color scheme
    -b, --branch        print the branch name
    -c, --commit LENGTH print the commit id, truncated to LENGTH
    -s, --state         print the repository state

Known problems

Right now the colorized output creates cursor position reset bugs, I have to figure out how to escape the ANSI sequences.

Dependencies

~11MB
~259K SLoC