Eitan Adler | 3fc60b5 | 2012-04-17 00:24:58 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 2 | # Initialize Bash It |
| 3 | |
| 4 | # Reload Library |
| 5 | alias reload='source ~/.bash_profile' |
| 6 | |
John Schulz | e319423 | 2011-10-28 19:22:20 -0400 | [diff] [blame] | 7 | # Only set $BASH_IT if it's not already set |
Travis Swicegood | b59ee65 | 2011-10-29 18:56:36 -0500 | [diff] [blame] | 8 | if [ -z "$BASH_IT" ]; |
| 9 | then |
| 10 | # Setting $BASH to maintain backwards compatibility |
| 11 | # TODO: warn users that they should upgrade their .bash_profile |
| 12 | export BASH_IT=$BASH |
| 13 | export BASH=`bash -c 'echo $BASH'` |
| 14 | fi |
| 15 | |
| 16 | # For backwards compatibility, look in old BASH_THEME location |
| 17 | if [ -z "$BASH_IT_THEME" ]; |
| 18 | then |
| 19 | # TODO: warn users that they should upgrade their .bash_profile |
| 20 | export BASH_IT_THEME="$BASH_THEME"; |
| 21 | unset $BASH_THEME; |
| 22 | fi |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 23 | |
Erich Smith | a8fcf9f | 2012-04-27 15:07:04 -0400 | [diff] [blame] | 24 | # Load composure first, so we support function metadata |
| 25 | source "${BASH_IT}/lib/composure.sh" |
| 26 | |
Travis Swicegood | b6d444d | 2011-10-29 18:55:20 -0500 | [diff] [blame] | 27 | # Load colors first so they can be use in base theme |
| 28 | source "${BASH_IT}/themes/colors.theme.bash" |
| 29 | source "${BASH_IT}/themes/base.theme.bash" |
| 30 | |
| 31 | # library |
| 32 | LIB="${BASH_IT}/lib/*.bash" |
| 33 | for config_file in $LIB |
| 34 | do |
| 35 | source $config_file |
| 36 | done |
| 37 | |
Travis Swicegood | d7cfa8b | 2011-06-21 09:31:26 -0500 | [diff] [blame] | 38 | # Load enabled aliases, completion, plugins |
| 39 | for file_type in "aliases" "completion" "plugins" |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 40 | do |
Travis Swicegood | b524bb6 | 2012-03-26 11:19:38 -0500 | [diff] [blame] | 41 | _load_bash_it_files $file_type |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 42 | done |
| 43 | |
Travis Swicegood | d7cfa8b | 2011-06-21 09:31:26 -0500 | [diff] [blame] | 44 | # Load any custom aliases that the user has added |
John Schulz | 323ce20 | 2011-09-20 11:07:48 -0400 | [diff] [blame] | 45 | if [ -e "${BASH_IT}/aliases/custom.aliases.bash" ] |
Mark Szymanski | 78270b3 | 2011-06-17 11:22:39 -0500 | [diff] [blame] | 46 | then |
John Schulz | 323ce20 | 2011-09-20 11:07:48 -0400 | [diff] [blame] | 47 | source "${BASH_IT}/aliases/custom.aliases.bash" |
Mark Szymanski | 78270b3 | 2011-06-17 11:22:39 -0500 | [diff] [blame] | 48 | fi |
Mark Szymanski | 50179fd | 2011-06-13 22:05:45 -0500 | [diff] [blame] | 49 | |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 50 | # Custom |
John Schulz | 323ce20 | 2011-09-20 11:07:48 -0400 | [diff] [blame] | 51 | CUSTOM="${BASH_IT}/custom/*.bash" |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 52 | for config_file in $CUSTOM |
| 53 | do |
Jon Schewe | 7d18ccc | 2011-10-09 20:44:29 -0500 | [diff] [blame] | 54 | if [ -e "${config_file}" ]; then |
| 55 | source $config_file |
| 56 | fi |
Robert R Evans | a7d1ee0 | 2010-10-02 15:04:24 -0700 | [diff] [blame] | 57 | done |
| 58 | |
Robert R Evans | 2010f01 | 2010-10-10 09:24:19 -0700 | [diff] [blame] | 59 | unset config_file |
John Schulz | 6e7f423 | 2010-11-11 11:57:47 -0500 | [diff] [blame] | 60 | if [[ $PROMPT ]]; then |
| 61 | export PS1=$PROMPT |
| 62 | fi |
Robert R Evans | c9da086 | 2010-10-06 17:27:55 -0700 | [diff] [blame] | 63 | |
| 64 | # Adding Support for other OSes |
| 65 | PREVIEW="less" |
| 66 | [ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" |
| 67 | [ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" |
| 68 | |
Mark Szymanski | 9ad7964 | 2011-06-24 17:49:19 -0500 | [diff] [blame] | 69 | # Load all the Jekyll stuff |
| 70 | |
| 71 | if [ -e $HOME/.jekyllconfig ] |
| 72 | then |
| 73 | . $HOME/.jekyllconfig |
| 74 | fi |
| 75 | |
Robert R Evans | c9da086 | 2010-10-06 17:27:55 -0700 | [diff] [blame] | 76 | |
Robert R Evans | a7d1ee0 | 2010-10-02 15:04:24 -0700 | [diff] [blame] | 77 | # |
| 78 | # Custom Help |
| 79 | |
| 80 | function bash-it() { |
| 81 | echo "Welcome to Bash It!" |
| 82 | echo |
| 83 | echo "Here is a list of commands you can use to get help screens for specific pieces of Bash it:" |
| 84 | echo |
Erich Smith | 1920629 | 2012-05-13 21:44:12 -0400 | [diff] [blame^] | 85 | echo " rails-help list out all aliases you can use with rails." |
| 86 | echo " git-help list out all aliases you can use with git." |
| 87 | echo " todo-help list out all aliases you can use with todo.txt-cli" |
| 88 | echo " brew-help list out all aliases you can use with Homebrew" |
| 89 | echo " aliases-help generic list of aliases." |
| 90 | echo " plugins-help list out all functions you have installed with bash-it" |
| 91 | echo " bash-it-plugins summarize bash-it plugins, and their installation status" |
| 92 | echo " reference <function name> detailed help for a specific function" |
Robert R Evans | a7d1ee0 | 2010-10-02 15:04:24 -0700 | [diff] [blame] | 93 | echo |
Mark Szymanski | e6fb703 | 2010-10-31 15:32:22 -0500 | [diff] [blame] | 94 | } |