Skip to content
Snippets Groups Projects
Commit d2af6682 authored by Eliott Sammier's avatar Eliott Sammier
Browse files

Add CLI command to enter environment

parent 81abbc49
Branches
No related tags found
No related merge requests found
#!/usr/bin/env bash
MACAO_ROOT="${MACAO_ROOT:-$(dirname "$0")}"
SOURCES_DIR="$MACAO_ROOT/Basilisk/MACAO/macao_12"
SCRIPTS_DIR="$MACAO_ROOT/tetras_extraction/macao_12/script"
RESULTS_DIR="$MACAO_ROOT/tetras_extraction/macao_12/result"
export MACAO_ROOT="${MACAO_ROOT:-$(dirname "$0")}"
export SOURCES_DIR="$MACAO_ROOT/Basilisk/MACAO/macao_12"
export SCRIPTS_DIR="$MACAO_ROOT/tetras_extraction/macao_12/script"
export RESULTS_DIR="$MACAO_ROOT/tetras_extraction/macao_12/result"
print_usage() {
cat <<EOF
......@@ -23,6 +23,9 @@ extract-rdf
Run the extractor to generate RDF from text sources
extract-mp3
Extract audio streams from all Flash SWF files
shell [-p|--pyenv]
Open a shell with mcli's environment variables set, including PATH.
If -p or --pyenv is specified, also enter the Python virtual env.
help
Print this help and exit
EOF
......@@ -102,6 +105,17 @@ extract-mp3)
"$SCRIPTS_DIR/extract_mp3.sh" --output-dir "$RESULTS_DIR/audio" "$audio_file"
done
;;
shell)
export PATH="$PATH:$MACAO_ROOT"
if [[ "$1" = "-p" || "$1" = "--pyenv" ]]; then
if ! source "$SCRIPTS_DIR/venv/bin/activate"; then
echo "Python venv not found, did you run setup first?" >&2
exit 1
fi
fi
cd "$MACAO_ROOT"
$SHELL
;;
*)
print_usage
;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment