From b6a0d0a92937e2f9df315460cfdfd8d7800369ea Mon Sep 17 00:00:00 2001 From: Weltolk <40228052+Weltolk@users.noreply.github.com> Date: Thu, 13 Apr 2023 16:38:15 +0800 Subject: [PATCH 1/4] bug fix in linux --- scripts/zsh_setup.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/zsh_setup.sh b/scripts/zsh_setup.sh index 312fc0f..d7d7090 100755 --- a/scripts/zsh_setup.sh +++ b/scripts/zsh_setup.sh @@ -43,7 +43,18 @@ validateSettings() configureZsh() { # Remove previous settings - sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath + + # Get the name of the current operating system + system_name="$(uname -s)" + + # Check if the current system is Darwin (i.e. MacOS) + if [ "$system_name" == "Darwin" ]; then + # Command to execute on MacOS + sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' "$zshrcPath" + else + # Command to execute on Linux + sed -i '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' "$zshrcPath" + fi echo "Removed previous settings in $zshrcPath if present" # Update the latest settings @@ -116,4 +127,4 @@ echo -e "*** Setup complete! ***\n"; echo "***********************************************" echo "Open a new zsh terminal, type '#' followed by" echo "your natural language command and hit Ctrl + G!" -echo "***********************************************" \ No newline at end of file +echo "***********************************************" From 92a20b9db8a7440fd57f340b1fb78f642657ee5b Mon Sep 17 00:00:00 2001 From: Weltolk <40228052+Weltolk@users.noreply.github.com> Date: Thu, 13 Apr 2023 16:49:50 +0800 Subject: [PATCH 2/4] Update zsh_setup.sh --- scripts/zsh_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/zsh_setup.sh b/scripts/zsh_setup.sh index d7d7090..65c5d35 100755 --- a/scripts/zsh_setup.sh +++ b/scripts/zsh_setup.sh @@ -50,10 +50,10 @@ configureZsh() # Check if the current system is Darwin (i.e. MacOS) if [ "$system_name" == "Darwin" ]; then # Command to execute on MacOS - sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' "$zshrcPath" + sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath else # Command to execute on Linux - sed -i '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' "$zshrcPath" + sed -i '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath fi echo "Removed previous settings in $zshrcPath if present" From df04f6b8fa20215d03c020ca98dc66852cc3ba93 Mon Sep 17 00:00:00 2001 From: Weltolk <40228052+Weltolk@users.noreply.github.com> Date: Thu, 13 Apr 2023 16:57:27 +0800 Subject: [PATCH 3/4] Update zsh_setup.sh --- scripts/zsh_setup.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/zsh_setup.sh b/scripts/zsh_setup.sh index 65c5d35..30465ce 100755 --- a/scripts/zsh_setup.sh +++ b/scripts/zsh_setup.sh @@ -44,11 +44,8 @@ configureZsh() { # Remove previous settings - # Get the name of the current operating system - system_name="$(uname -s)" - # Check if the current system is Darwin (i.e. MacOS) - if [ "$system_name" == "Darwin" ]; then + if [[ "$OSTYPE" == "Darwin" ]]; then # Command to execute on MacOS sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath else From ae0f839c866e1c82404bdbe982428e89e5c7040f Mon Sep 17 00:00:00 2001 From: Weltolk <40228052+Weltolk@users.noreply.github.com> Date: Thu, 13 Apr 2023 17:00:01 +0800 Subject: [PATCH 4/4] Update zsh_cleanup.sh --- scripts/zsh_cleanup.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/zsh_cleanup.sh b/scripts/zsh_cleanup.sh index c12deae..79c84b1 100755 --- a/scripts/zsh_cleanup.sh +++ b/scripts/zsh_cleanup.sh @@ -9,11 +9,18 @@ openAIConfigPath="$CODEX_CLI_PATH/src/openaiapirc" zshrcPath="$HOME/.zshrc" # 1. Remove settings in .zshrc -sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath +# Check if the current system is Darwin (i.e. MacOS) +if [[ "$OSTYPE" == "Darwin" ]]; then + # Command to execute on MacOS + sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath +else + # Command to execute on Linux + sed -i '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath +fi echo "Removed settings in $zshrcPath if present" # 2. Remove opanaiapirc in /.config rm -f $openAIConfigPath echo "Removed $openAIConfigPath" -echo "Codex CLI clean up completed. Please open a new zsh to continue." \ No newline at end of file +echo "Codex CLI clean up completed. Please open a new zsh to continue."