Crates.io | dev_info |
lib.rs | dev_info |
version | 0.1.0 |
source | src |
created_at | 2018-07-18 19:46:12.054831 |
updated_at | 2018-07-18 19:46:12.054831 |
description | A simple utility to display git related info in a CLI prompt |
homepage | https://github.com/haxelion/dev_info |
repository | https://github.com/haxelion/dev_info |
max_upload_size | |
id | 74923 |
size | 9,566 |
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.
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
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
Right now the colorized output creates cursor position reset bugs, I have to figure out how to escape the ANSI sequences.