From eca6d4d9993eb86cc80191749f48f9fb312b141d Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 2 Feb 2022 03:07:28 +0100 Subject: [PATCH] Use ttp shell function from tritonshell --- users/teutat3s/zshrc.nix | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/users/teutat3s/zshrc.nix b/users/teutat3s/zshrc.nix index 8b6b3992..f6723c14 100644 --- a/users/teutat3s/zshrc.nix +++ b/users/teutat3s/zshrc.nix @@ -54,18 +54,32 @@ alias wg-down="sudo systemctl stop wg-quick@wg0.service" # Helper function for docker on triton - ttdo () { + ttp() { if [[ "$1" == "set" ]]; then if [[ -n "$2" ]]; then + source unset-env.sh triton profile set "$2" fi - source ~/CodeRoom/greenbaum.cloud/triton-docker.env.sh + source ~/CodeRoom/greenbaum.cloud/tritonshell/template/pkgs/utils/triton-docker.env.sh elif [[ "$1" == "unset" ]]; then - eval "$(triton env --unset)" && unset TRITON_CNS_SEARCH_DOMAIN_PRIVATE TRITON_CNS_SEARCH_DOMAIN_PUBLIC + source ~/CodeRoom/greenbaum.cloud/tritonshell/template/pkgs/utils/unset-env.sh elif [[ "$1" == "env" ]]; then - env | grep "DOCKER\|TRITON\|SDC" + env | grep "DOCKER\|MANTA\|SDC\|TRITON" | sort else - /usr/bin/docker $@ + 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 }