Skip to content

Commit

Permalink
shenv now features folders for envs than files
Browse files Browse the repository at this point in the history
needed for adding more features in the future
  • Loading branch information
sathyamvellal committed Jun 4, 2014
1 parent 8926578 commit 733d08c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Shell Environments v1.1
Shell Environments v1.2
=======================

#### Why do you need this?
Expand All @@ -25,7 +25,7 @@ For bash users
3. To create a new environment, use `envcreate <name> <directory>` where **name** is the name of the environment and **directory** is the *absolute* path to the environment's root.
4. To start an environment, use `envstart <name>` where **name** is the name of the environment
5. Similarly, to end the environment, use `envend <name>`.
6. You can add all your custom aliases, functions, environment variables in the `envinit` function in `<name>.shenv.sh` that is created at your `SHENV_HOME` directory.
6. You can add all your custom aliases, functions, environment variables in the `envinit` function in `<name>/shenv.sh` that is created at your `SHENV_HOME` directory.

#### An example (for bash)

Expand Down
9 changes: 5 additions & 4 deletions bash/shenvrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ fi

function envcreate()
{
if [ -f $SHENV_HOME/$1-shenv.sh ]; then
if [ -d $SHENV_HOME/$1 ]; then
echo "Environment already exists. Skipping ..."
else
mkdir $SHENV_HOME/$1 -p
echo \
"#!/bin/bash

Expand All @@ -41,16 +42,16 @@ function envend()
envend_super # This should be executed last
}

" > $SHENV_HOME/$1-shenv.sh
" > $SHENV_HOME/$1/shenv.sh
fi
}

function envstart()
{
if ls $SHENV_HOME/$1-shenv.sh >/dev/null 2>&1; then
if [ -d $SHENV_HOME/$1 ]; then
if ! type envend >/dev/null 2>&1; then
ENV_NAME=$1
. $SHENV_HOME/$1-shenv.sh
. $SHENV_HOME/$1/shenv.sh
fi
fi
}
Expand Down

0 comments on commit 733d08c

Please sign in to comment.