From ca2c258a0d92ae999e43251f8a4f4477051fb4fd Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 16 Apr 2013 15:43:11 +0200 Subject: [PATCH] new: added more shell configuration (better prompt, glog) to ``base-0k``. --- precise/base-0k/hooks/install | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/precise/base-0k/hooks/install b/precise/base-0k/hooks/install index d8e00d6..3307ca8 100755 --- a/precise/base-0k/hooks/install +++ b/precise/base-0k/hooks/install @@ -63,3 +63,40 @@ deb http://deb.kalysto.org no-dist kal-alpha kal-beta kal-main EOF + +## +## More shell configurations (prompt, functions) +## + +mkdir -p /etc/prompt + +cat < /etc/prompt/prompt.1.rc +PROMPT_COMMAND="" +parse_git_branch() { + ref=\$(git symbolic-ref HEAD 2> /dev/null) || return + echo -en ' (\033[0;32m'\${ref#refs/heads/}'\033[0m)' +} +export PS1="\[\033[0;37m\][\[\033[1;30m\]\u\[\033[0;37m\]@\[\033[1;30m\]\h\[\033[0;37m\]]-[\[\033[1;34m\]\w\[\033[0;37m\]]\\\$(parse_git_branch)\n\[\033[1;37m\]\\$ \[\033[0;37m\]" +EOF + +cat <> /root/.bashrc + +# Prompt easy management +prompt() { + prompt_name="prompt.\$1.rc" + + for i in /etc/prompt ~/.prompt; do + [ -f "\$i/\$prompt_name" ] && + . "\$i/\$prompt_name" + done +} + + +function glog() { + git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@" +} + + +prompt 1 + +EOF