Skip to content

Commit

Permalink
Updated README.md with new functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed May 2, 2017
1 parent c4a472c commit 9f19465
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 41 deletions.
60 changes: 32 additions & 28 deletions .bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -68,45 +68,36 @@ alias flush__dns="dscacheutil -flushcache"



#####################
### SPLASH SCREEN ###
#####################

function bash_profile__splash_screen {
echo;
echo -e " _ _ __ _ _ "
echo -e " | |__ __ _ __| |_ _ __ _ _ ___ / _(_) |___ "
echo -e " _| '_ \/ _\` (_-\< ' \ | '_ \\ '_/ _ \ _| | / -_) "
echo -e " (_)_.__/\__,_/__/_||_|__| .__/_| \___/_| |_|_\___| "
echo -e " |___|_| "
echo -e " "$(bash_profile__version)
echo;
echo;
}



###############
### UTILITY ###
###############

#
# bash_prifile get project path
function bash_profile__path {
echo $(dirname "$BASH_SOURCE")
}

# bash_profile move to project folder
function bash_profile__cd {
cd $(bash_profile__path)
}

# bash_profile get version
function bash_profile__version {
cat ~/bash_profile/VERSION
}

# bash_profile reload profile
# bash_profile reload the project
function bash_profile__reload {
#[[ -r "$HOME/.bash_profile" ]] && source ~/.bash_profile
#[[ -r "$HOME/.bashrc" ]] && source ~/.bashrc
source $(bash_profile__path)/.bash_profile
}

# bash_profile reload your own .bash_profile or .bashrc
function bash_profile__reload_all {
[[ -r "$HOME/.bash_profile" ]] && source ~/.bash_profile
[[ -r "$HOME/.bashrc" ]] && source ~/.bashrc
}

# bash_profile update
function bash_profile__update {
message=`git -C $(bash_profile__path) checkout . && git -C $(bash_profile__path) pull -r`
Expand All @@ -122,11 +113,6 @@ function bash_profile__update {
fi
}

# bash_profile move to project folder
function bash_profile__cd {
cd $(bash_profile__path)
}

# set the console title (OSX Terminal only)
function console__set_title {
title="$1"
Expand Down Expand Up @@ -278,6 +264,24 @@ export LSCOLORS=gxfxcxdxbxegedabagacad



#####################
### SPLASH SCREEN ###
#####################

function __bash_profile__splash_screen {
echo;
echo -e " _ _ __ _ _ "
echo -e " | |__ __ _ __| |_ _ __ _ _ ___ / _(_) |___ "
echo -e " _| '_ \/ _\` (_-\< ' \ | '_ \\ '_/ _ \ _| | / -_) "
echo -e " (_)_.__/\__,_/__/_||_|__| .__/_| \___/_| |_|_\___| "
echo -e " |___|_| "
echo -e " "$(bash_profile__version)
echo;
echo;
}



###############
### GETOPTS ###
###############
Expand All @@ -286,7 +290,7 @@ OPTIND=1
while getopts "wu" OPT; do
case $OPT in
w)
bash_profile__splash_screen
__bash_profile__splash_screen
;;
u)
(bash_profile__update > /dev/null 2>&1 &)
Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@ This is a collection of bash utilities. It contains:
Clone this project in your home folder `~`.

```sh
# clone with SSH
cd ~ && git clone git@github.com:marcomontalbano/bash_profile.git

# OR

# clone with HTTPS
cd ~ && git clone https://github.com/marcomontalbano/bash_profile.git
```

Open and modify your `~/.bash_profile` on OS X and Windows or `~/.bashrc` on Ubuntu, adding the following script.

```sh
# https://github.com/marcomontalbano/bash_profile
source ~/bash_profile/.bash_profile
source ~/bash_profile/.bash_profile -u
```

### Options

- `-u`: enables self-update for bash_profile. (the latest release will automatically downloaded and loaded)
- `-w`: show welcome screen on new tabs.


## Completions

Expand All @@ -57,23 +56,27 @@ curl https://gist.githubusercontent.com/marcomontalbano/7c48f6756e4e4133c30fdb8e

Below a list of utilities that you can use on command line or your own .bash_profile.

- **bash_profile__path** - get project path.

- **bash_profile__cd** - `cd` to the `bash_profile` folder. Something like `cd ~/bash_profile`

- **bash_profile__version** - get current version.

- **bash_profile__reload** - reload your `.bash_profile`.
- **bash_profile__reload** - reload the project.

- **bash_profile__update** - update the `bash_profile` project with latest changes. Is "just" a `git pull` :smile:
- **bash_profile__reload_all** - reload your own `.bash_profile` or `.bashrc`.

- **bash_profile__cd** - `cd` to the `bash_profile` folder. Something like `cd ~/bash_profile`
- **bash_profile__update** - update the `bash_profile` project with latest changes. Is "just" a `git pull` :smile:

- **console__set_title** - set a console title.
- **console__set_title** - set a console title. _(only for OS X)_

- **cli__is_installed** - check if a program is installed on your system. *`cli__is_installed node` will return `true` if node is installed on your system, `false` otherwise.*

- **proxy__set** - simply set the command line proxy. It works also for npm and apm, if you use them. *usage: `proxy__set http://domain:8080` or `proxy__set http://domain:8080 https://domain:8080`*

- **proxy__unset** - simply unset the command line proxy.

- **java__use_jdk** - if you work with different version of JDK, you can easily switch with `java__use_jdk 1.8`. (only for OS X)
- **java__use_jdk** - if you work with different version of JDK, you can easily switch with `java__use_jdk 1.8`. _(only for OS X)_


## PS1 customization
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.4.1

0 comments on commit 9f19465

Please sign in to comment.