From 54190e819bbec541008b3ecaf06bb2ed3e93cdf6 Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Mon, 30 Oct 2023 10:54:29 -0400 Subject: [PATCH] move guru shell to its ownd file --- configs/scripts/guru-shell | 41 +++++++++++++++++++++++++++++++++++ configs/shells/bash/macros.sh | 41 ++++++----------------------------- 2 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 configs/scripts/guru-shell diff --git a/configs/scripts/guru-shell b/configs/scripts/guru-shell new file mode 100644 index 0000000..e30d38c --- /dev/null +++ b/configs/scripts/guru-shell @@ -0,0 +1,41 @@ +#! /bin/bash +set -e + +# If //qs does not exist +if [ ! -d "//qs" ]; then + echo "This command must be executed on a studio machine!" + return 1 +fi + +# Figure out the appropriate prefix +if [ $(uname -o | grep -c Msys) -gt 0 ]; then + s_drive="S:/" + pathsep=";" +else + s_drive="//qs/resources" + pathsep=":" +fi + +# Ask if we want to use the development env +echo "Do you want to use the development environment? (Y/n)" +read dev_env +if [ "$dev_env" == "n" ]; then + studio2023_path="studio/studio2023" + ps1_mode="" +else + studio2023_path="development/epratten/studio/studio2023" + ps1_mode="-dev" +fi + +# Set PYTHONPATH based on the data we learned +PYTHONPATH="$s_drive/$studio2023_path/env$pathsep$PYTHONPATH" +PYTHONPATH="$s_drive/$studio2023_path$pathsep$PYTHONPATH" + +# Update the PATH to point to the studio's install of python +PATH="/c/Programs/software/win/core/python/python_3.7.7$pathsep$PATH" + +# Configure the prompt +PS1_CTX="guru$ps1_mode bash" + +# Finally, start bash +bash \ No newline at end of file diff --git a/configs/shells/bash/macros.sh b/configs/shells/bash/macros.sh index 76f4dd8..df4352a 100644 --- a/configs/shells/bash/macros.sh +++ b/configs/shells/bash/macros.sh @@ -203,37 +203,10 @@ ewconfig-pull-zip(){ cd $cwd } -# Pop a shell inside Guru env -guru-shell() { - # If //qs does not exist - if [ ! -d "//qs" ]; then - echo "This command must be executed on a studio machine!" - return 1 - fi - - # Figure out the appropriate prefix - if [ $(uname -o | grep -c Msys) -gt 0 ]; then - s_drive="S:/" - pathsep=";" - else - s_drive="//qs/resources" - pathsep=":" - fi - - # Ask if we want to use the development env - echo "Do you want to use the development environment? (Y/n)" - read dev_env - if [ "$dev_env" == "n" ]; then - studio2023_path="studio/studio2023" - ps1_mode="" - else - studio2023_path="development/epratten/studio/studio2023" - ps1_mode="-dev" - fi - - PYTHONPATH="$s_drive/$studio2023_path/env$pathsep$PYTHONPATH" \ - PYTHONPATH="$s_drive/$studio2023_path$pathsep$PYTHONPATH" \ - PATH="/c/Programs/software/win/core/python/python_3.7.7$pathsep$PATH" \ - PS1_CTX="guru$ps1_mode bash" \ - bash -} \ No newline at end of file +# Temporairly hop to the ewconfig directory to run a command +ewconfig-run() { + cwd=$(pwd) + cd ~/.config/ewconfig + $@ + cd $cwd +}