Skip to content

ekalinin/version-control-prompt.ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

version-control-prompt.ml

Shell prompt for version control systems (git, hg, svn)

Screenshot

Here is an example of the prompt in gnome-terminal:

Example

Dependencies

Only Ocaml's core. Installation on Ubuntu:

$ sudo add-apt-repository ppa:avsm/ppa
$ sudo apt-get update
$ sudo apt-get install ocaml opam
$ opam install core

How to build

$ git clone https://github.com/ekalinin/version-control-prompt.ml.git
$ cd version-control-prompt.ml
$ make
$ ls bin/
version-control-prompt

How to use

Copy binary in some constant path, for example ~/bin:

$ mkdir -p ~/bin
$ cp bin/version-control-prompt ~/bin

For bash, add the follow in your ~/.bashrc:

PURPLE2="\033[1;35m"
RESET="\033[m"

vc_prompt() {
    local vc_prompt=$(~/bin/version-control-prompt)
    if [ "$vc_prompt"  != "" ]; then
        echo -e "on $PURPLE2$vc_prompt$RESET"
    fi
}


PS1='\u@\h:\w $(vc_prompt)\$ '

Default format string:

%type|%branch|%status %stats

You can override id like this:

# ...

vc_prompt() {
    local vc_prompt=$(~/bin/version-control-prompt --fmt "(%type:%branch:%status)")
    if [ "$vc_prompt"  != "" ]; then
        echo -e "on $PURPLE2$vc_prompt$RESET"
    fi
}

# ...

LICENSE

MIT / LICENSE

About

Shell prompt for version control systems (git, hg, svn)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published