Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/classes/bashrc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
:owner=>"0",
:group=>"0",
:mode=>"0555",
:content=>"#!/bin/bash\n#\n#this file is responsible for setting the bash shell prompt for a user. it builds the prompt from values\n# fed to the bashrc module\n#Enable Colors\nreset=$(tput sgr0)\nred=$(tput setaf 1)\ngreen=$(tput setaf 2)\nyellow=$(tput setaf 3)\nblue=$(tput setaf 4)\npurple=$(tput setaf 5)\ncyan=$(tput setaf 6)\nwhite=$(tput setaf 7)\ncolone=$blue\ncoltwo=$white\ngitcol=$yellow\nif [ -f ~/.bashrc ]; then\n #we have a user-specific bashrc. Hook into it so we're confident we get run \"last\"\n if [ `grep -c /etc/profile.d/prompt.sh ~/.bashrc` -lt 1 ]; then\n #we don't seem to have already introduced ourselves to the user's bashrc file. Lets go introduce ourselves\n echo '#set the prompt to include nice pretty colors. Courtesy of bashrc::prompt, most specifically /etc/profile.d/prompt.sh' >> ~/.bashrc\n echo '. /etc/profile.d/prompt.sh' >> ~/.bashrc\n fi\nfi\n\nif [ $UID -eq 0 ]; then\n export PS1=\"\\[$red\\][\\[$colone\\]\\u\\[$white\\]@\\[$coltwo\\]\\h \\W\\[$gitcol\\]\\$(__git_ps1)\\[$reset\\]\\[$red\\]]\\[$reset\\]# \"\nelse\n export PS1=\"[\\[$colone\\]\\u\\[$white\\]@\\[$coltwo\\]\\h \\W\\[$gitcol\\]\\$(__git_ps1)\\[$reset\\]]\\$ \"\nfi\n"
:content=>"#!/bin/bash\n#\n#this file is responsible for setting the bash shell prompt for a user. it builds the prompt from values\n# fed to the bashrc module\n#Enable Colors\nreset=$(tty -s && tput sgr0)\nred=$(tty -s && tput setaf 1)\ngreen=$(tty -s && tput setaf 2)\nyellow=$(tty -s && tput setaf 3)\nblue=$(tty -s && tput setaf 4)\npurple=$(tty -s && tput setaf 5)\ncyan=$(tty -s && tput setaf 6)\nwhite=$(tty -s && tput setaf 7)\ncolone=$blue\ncoltwo=$white\ngitcol=$yellow\nif [ -f ~/.bashrc ]; then\n #we have a user-specific bashrc. Hook into it so we're confident we get run \"last\"\n if [ `grep -c /etc/profile.d/prompt.sh ~/.bashrc` -lt 1 ]; then\n #we don't seem to have already introduced ourselves to the user's bashrc file. Lets go introduce ourselves\n echo '#set the prompt to include nice pretty colors. Courtesy of bashrc::prompt, most specifically /etc/profile.d/prompt.sh' >> ~/.bashrc\n echo '. /etc/profile.d/prompt.sh' >> ~/.bashrc\n fi\nfi\n\nif [ $UID -eq 0 ]; then\n export PS1=\"\\[$red\\][\\[$colone\\]\\u\\[$white\\]@\\[$coltwo\\]\\h \\W\\[$gitcol\\]\\$(__git_ps1)\\[$reset\\]\\[$red\\]]\\[$reset\\]# \"\nelse\n export PS1=\"[\\[$colone\\]\\u\\[$white\\]@\\[$coltwo\\]\\h \\W\\[$gitcol\\]\\$(__git_ps1)\\[$reset\\]]\\$ \"\nfi\n"
})
end

Expand Down
16 changes: 8 additions & 8 deletions templates/prompt.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
# fed to the bashrc module
<% if enablecolor == true -%>
#Enable Colors
reset=$(tput sgr0)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
purple=$(tput setaf 5)
cyan=$(tput setaf 6)
white=$(tput setaf 7)
reset=$(tty -s && tput sgr0)
red=$(tty -s && tput setaf 1)
green=$(tty -s && tput setaf 2)
yellow=$(tty -s && tput setaf 3)
blue=$(tty -s && tput setaf 4)
purple=$(tty -s && tput setaf 5)
cyan=$(tty -s && tput setaf 6)
white=$(tty -s && tput setaf 7)
colone=$<%= colone %>
coltwo=$<%= coltwo %>
<% if enablegit == true -%>
Expand Down