diff --git a/bin/anisotropy b/bin/anisotropy new file mode 100755 index 0000000..ad6c874 --- /dev/null +++ b/bin/anisotropy @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.." +cd ${DIR} + +anisotropy-help() +{ + echo "Usage:" + echo " anisotropy [options]" + echo "" + echo "Commands:" + echo " clean Clean project directory via git (.gitignore)." + echo " init Activate environment and install dependencies." + echo " run Start calculations and etc." + echo " help Show help for commands." + echo "" + echo "Options:" + echo " -c, --config Use custom configuration file." +} + +case $1 in + clean) + git clean -fdx + ;; + + init) + python -m venv env + source env/bin/activate + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + deactivate + ;; + + run) + source ${OPENFOAM} + source env/bin/activate + python ${DIR}/anisotropy/anisotropy.py + deactivate + ;; + + help) + anisotropy-help + exit 1 + ;; + + *) + echo "Unknown command." + anisotropy-help + exit 1 + ;; +esac diff --git a/bin/anisotropy.sh b/bin/anisotropy.sh deleted file mode 100755 index 4a72c95..0000000 --- a/bin/anisotropy.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.." -cd ${DIR} - -if [ "$1" = "clean" ]; then - git clean -fdx - -elif [ "$1" = "init" ]; then - python -m venv env - source env/bin/activate - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - deactivate - -elif [ "$1" = "run" ]; then - source ${OPENFOAM} - source env/bin/activate - python ${DIR}/anisotropy/anisotropy.py - deactivate - -fi