#!/bin/bash set -e pushd $(cd $(dirname ${0})/..; pwd) > /dev/null case "${OSTYPE}" in msys*) python="winpty python";; *) python=python3;; esac bold() { echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)" } clean() { bold "mlnet clean" rm -rf "./third_party/src/mlnet" } sync() { bold "mlnet sync" [ -d "./third_party/src/mlnet" ] || git clone --quiet --recursive https://github.com/dotnet/machinelearning.git "./third_party/src/mlnet" pushd "./third_party/src/mlnet" > /dev/null git pull --quiet --prune git submodule sync --quiet git submodule update --quiet --init --recursive popd > /dev/null } metadata() { bold "mlnet metadata" export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python ${python} ./tools/mlnet-script.py metadata } while [ "$#" != 0 ]; do command="$1" && shift case "${command}" in "clean") clean;; "sync") sync;; "metadata") metadata;; esac done