Coder Social home page Coder Social logo

bash-beautify's Introduction

Bash Beautify
================================================================================
Bash Beautify adds simple color support and SVN and GIT branch recognition to
your bash prompt.

--------------------------------------------------------------------------------
+ Requirements
--------------------------------------------------------------------------------
- If using SVN, your project must use a standard /trunk /branches /tags
  structure.

--------------------------------------------------------------------------------
+ Installation
--------------------------------------------------------------------------------
1. Place the .bash_beautify file in your home directory.
2. Add the following line to the top of your .bash_profile or .bashrc file.

source ~/.bash_beautify

That's it!  The next time you start a bash session you should see a pretty, new
bash prompt.

By default GIT branches are green and SVN are yellow.

If you would like to customzize your prompt, add the following line
under the previous one and use the brief tutorial below. (It might be helpful to
copy the one from the bottom of the actual file to start.)

export PS1="[\u@\h]\$"

--------------------------------------------------------------------------------
+ Building Your Bash Prompt
--------------------------------------------------------------------------------
The bash prompt is really just a string with a few variables in it.  Here is a
list of the basic variables you can use and how they work:

UNIX COMMANDS
-------------
These will be replaced with their respective values.

\u    Your username. (ex. calbrecht)
\h    Your system hostname. (ex. localhost)
\w    Your present working directory. (ex. /var/www/htdocs/website)

COLORS
------
These will alter the color of the text from this point forward.  Use the reset
at the bottom to stop using the changed color.

${BLACK}
${RED}
${GREEN}
${YELLOW}
${BLUE}
${VIOLET}
${CYAN}
${WHITE}
${BRIGHT_BLACK}
${BRIGHT_RED}
${BRIGHT_GREEN}
${BRIGHT_YELLOW}
${BRIGHT_BLUE}
${BRIGHT_VIOLET}
${BRIGHT_CYAN}
${BRIGHT_WHITE}
${NORMAL}
${RESET}

SVN and GIT
-----------
The icing on the cake.  Add this variable to your line and it will be replaced
with "(GIT_BRANCH|SVN_BRANCH)" depending on which (or both if you are crazy
enough) version control system you are using.

$(vcs_branch)

--------------------------------------------------------------------------------
+ Examples
--------------------------------------------------------------------------------
1. A basic prompt.

   [calbrecht@localhost]$
   export PS1="[\u@\h]\$"


2. Add the present working directory to each prompt.

   [calbrecht@localhost: /var/www/htdocs/newsite/includes]$
   export PS1="[\u@\h: \w]\$"


3. Put the VCS branches in it.

   [calbrecht@localhost(7.x-1.x): /var/www/htdocs/newsite/includes]$
   export PS1="[\u@\h$(vcs_branch): \w]\$"


4. Spice it up with a little color.

   [calbrecht@localhost(7.x-1.x): /var/www/htdocs/newsite/includes]$
   export PS1="${BRIGHT_CYAN}[${CYAN}\u${BRIGHT_WHITE}@${CYAN}\h${WHITE}\$(vcs_branch)${WHITE}: \w${BRIGHT_CYAN}]${NORMAL}\$ ${RESET}"


--------------------------------------------------------------------------------
+ Advanced
--------------------------------------------------------------------------------
If you don't like the colors of the SVN and GIT branches, you can change those
in the .bash_beautify file in the vcs_branches function.  I coded them in there
to make it easier to deploy for newbies.

You can also call either piece separately without any formatting:

$(git_branch)
$(svn_branch)

bash-beautify's People

Contributors

chrisalbrechtnrel avatar mortenn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.