Skip to content

Commit

Permalink
Merge pull request #5 from ashkue/master
Browse files Browse the repository at this point in the history
changed theme parameter to be environment variable
  • Loading branch information
pavelsource authored Jul 23, 2018
2 parents 1b4e9f5 + 1929ae6 commit 4a81a65
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 32 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ Run it the same way you would run `sceptre`:
sceptrefun $action $env $stack
```

By default it uses Warcraft sounds, but you can override this behaviour using additional `-t` flag:
By default it uses Warcraft sounds, but you can override this behaviour using `SCEPTRE_THEME` environment variable, just run one of the following commands:

- `-t terran` - for Starcraft Terrain sounds
- `-t protoss` - for Starcraft Protoss sounds
- `-t zerg` - for Starcraft Zerg sounds
- `export SCEPTRE_THEME="terran"` - for Starcraft Terran sounds
- `export SCEPTRE_THEME="protoss"` - for Starcraft Protoss sounds
- `export SCEPTRE_THEME="zerg"` - for Starcraft Zerg sounds

Command with override could look like this:

```bash
sceptrefun -t terran launch-stack dev vpc
export SCEPTRE_THEME="terran"
sceptrefun launch-stack dev vpc
```

If you trust this project and want to stop typing `sceptrefun` everytime, put this in your `~/.zshrc` or `~/.bashrc`:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
41 changes: 14 additions & 27 deletions sceptrefun
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,21 @@ SCEPTRE_ACTION=$1
SCEPTRE_ENV=$2
SCEPTRE_STACK=$3
CHANGE_SET=$4
THEME="orc"

while getopts "t:" OPTION
do
case $OPTION in
t)
THEME="$OPTARG"
if [ ! -d "$BASEDIR/assets/$THEME" ]; then
echo -e '\033[1;33m'"'$THEME' theme does not exist" '\033[0m'
exit 1
fi
ARGTOTAL=5
SCEPTRE_ACTION=$3
SCEPTRE_ENV=$4
SCEPTRE_STACK=$5
CHANGE_SET=$6
;;
esac
done

SCEPTRE_UPGRADE_STACK="$BASEDIR/assets/$THEME/jobupdate.mp3"
SCEPTRE_DELETE_STACK="$BASEDIR/assets/$THEME/jobdelete.mp3"
SCEPTRE_SUCCESS="$BASEDIR/assets/$THEME/jobdone.mp3"
SCEPTRE_FAIL="$BASEDIR/assets/$THEME/jobfail.mp3"
SCEPTRE_INIT="$BASEDIR/assets/$THEME/jobinit.mp3"
MISSINGARGS="$BASEDIR/assets/$THEME/missingargs.mp3"
TRAPC="$BASEDIR/assets/$THEME/trapc.mp3"
SCEPTRE_THEME_DEFAULT="orc"
SCEPTRE_THEME=${SCEPTRE_THEME-$SCEPTRE_THEME_DEFAULT}

if [ ! -d "$BASEDIR/assets/$SCEPTRE_THEME" ]; then
echo -e '\033[1;33m'"'$SCEPTRE_THEME' theme does not exist, will use default '$SCEPTRE_THEME_DEFAULT' theme" '\033[0m'
SCEPTRE_THEME=$SCEPTRE_THEME_DEFAULT
fi

SCEPTRE_UPGRADE_STACK="$BASEDIR/assets/$SCEPTRE_THEME/jobupdate.mp3"
SCEPTRE_DELETE_STACK="$BASEDIR/assets/$SCEPTRE_THEME/jobdelete.mp3"
SCEPTRE_SUCCESS="$BASEDIR/assets/$SCEPTRE_THEME/jobdone.mp3"
SCEPTRE_FAIL="$BASEDIR/assets/$SCEPTRE_THEME/jobfail.mp3"
SCEPTRE_INIT="$BASEDIR/assets/$SCEPTRE_THEME/jobinit.mp3"
MISSINGARGS="$BASEDIR/assets/$SCEPTRE_THEME/missingargs.mp3"
TRAPC="$BASEDIR/assets/$SCEPTRE_THEME/trapc.mp3"

trap trapctrlc SIGINT
trapctrlc() {
Expand Down

0 comments on commit 4a81a65

Please sign in to comment.