New: help function
This commit is contained in:
parent
7ac40272ff
commit
fd110141b1
50
bin/anisotropy
Executable file
50
bin/anisotropy
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.."
|
||||||
|
cd ${DIR}
|
||||||
|
|
||||||
|
anisotropy-help()
|
||||||
|
{
|
||||||
|
echo "Usage:"
|
||||||
|
echo " anisotropy <command> [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 <path-to-file> 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
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user