StGit-enabled bash-prompt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I added the following snippet to my .bashrc to help me keep track of what 
patch I'm working on.  I got annoyed at typing stg top/stg series all the 
time.

This changes the bash prompt to include the current git branch and the top 
stgit patch to the prompt.

Of course you will read and understand this code. I don't know how good an 
idea it is to use the DEBUG trap this way.

NO WARRANTY (as always)

-- robin

if [ "$PS1" ]; then
    function stgtag
    {
        br=$(stg branch 2>/dev/null)
        top=$(stg top 2>/dev/null)
        if [[ -n "$br$top" ]];then
            echo " [$top@$br] "
        fi
    }
    trap 'PS1="\u@\h$(stgtag)\w]\$ "' DEBUG

fi
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]