|
a |
|
b/bin/dosma |
|
|
1 |
#!/bin/bash |
|
|
2 |
|
|
|
3 |
# Bash interface for DOSMA |
|
|
4 |
# |
|
|
5 |
# @usage (from terminal/command line): |
|
|
6 |
# Command line interface: ./dosma command-line-args |
|
|
7 |
# User Interface: ./dosma --app |
|
|
8 |
# |
|
|
9 |
# @initialization protocol: |
|
|
10 |
# 1. Navigate to this folder |
|
|
11 |
# 2. Run "chmod +x dosma" from command-line (Linux) or Terminal (MacOS) |
|
|
12 |
# |
|
|
13 |
# @author: Arjun Desai, Stanford University |
|
|
14 |
# (c) Stanford University, 2019 |
|
|
15 |
|
|
|
16 |
BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
|
|
17 |
DOSMA_DIR="$( cd "$( dirname "${BIN_DIR}" )" >/dev/null 2>&1 && pwd )" |
|
|
18 |
DOSMA_ENV_NAME="dosma_env" |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
# Check if environment is active |
|
|
22 |
if [[ -z `conda env list | grep \* | grep $DOSMA_ENV_NAME` ]]; then |
|
|
23 |
echo "Activate $DOSMA_ENV_NAME before running this script." |
|
|
24 |
exit 1 |
|
|
25 |
fi |
|
|
26 |
|
|
|
27 |
cd $DOSMA_DIR |
|
|
28 |
if [[ $1 == "--app" ]]; then |
|
|
29 |
python -m dosma.app |
|
|
30 |
else |
|
|
31 |
python -m dosma.cli $* |
|
|
32 |
fi |