tritonshell/template/pkgs/utils/ttp.sh
2022-03-03 02:09:40 +01:00

31 lines
1 KiB
Bash

#!/usr/bin/env bash
# helper function to set the docker, triton, manta and CNS env vars for the current triton profile
ttp() {
if [[ "$1" == "set" ]]; then
if [[ -n "$2" ]]; then
source unset-env.sh
triton profile set "$2"
fi
source triton-docker-env.sh
elif [[ "$1" == "unset" ]]; then
source unset-env.sh
elif [[ "$1" == "env" ]]; then
env | grep "DOCKER\|MANTA\|SDC\|TRITON" | sort
else
echo "this is a helper function to quickly switch triton profiles"
echo "and setup the required environment variables"
echo "for triton, manta and the remote docker host (API)"
echo
echo 'use "ttp set your-profile" to switch to a profile'
echo
echo 'use "ttp unset" to clear all environment variables used by these CLIs'
echo "useful if you'd like to run a docker command against the"
echo "local docker host"
echo
echo 'use "ttp env" to view the currently set environment variables'
echo "used by the triton & manta CLIs"
echo
echo 'use "ttp help" to view this help'
fi
}