Skip to content

Commit e074dc2

Browse files
committed
refactor: Improve install.sh error handling and check for existing Oh My Zsh installation
1 parent b4e25da commit e074dc2

File tree

3 files changed

+39
-33
lines changed

3 files changed

+39
-33
lines changed

.vscode/settings.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"editor.formatOnSave": true,
3-
"editor.defaultFormatter": "esbenp.prettier-vscode",
4-
"files.eol": "\n",
5-
"files.trimTrailingWhitespace": true,
6-
"files.insertFinalNewline": true,
7-
"javascript.validate.enable": true,
8-
"typescript.validate.enable": true,
9-
"eslint.validate": [
10-
"javascript",
11-
"javascriptreact",
12-
"typescript",
13-
"typescriptreact"
14-
],
15-
"eslint.format.enable": true,
16-
"editor.codeActionsOnSave": {
17-
"source.fixAll.eslint": "explicit"
18-
},
19-
"npm.packageManager": "pnpm",
20-
"terminal.integrated.defaultProfile.linux": "zsh",
21-
"terminal.integrated.profiles.linux": {
22-
"zsh": {
23-
"path": "/bin/zsh"
24-
}
2+
"editor.formatOnSave": true,
3+
"editor.defaultFormatter": "esbenp.prettier-vscode",
4+
"editor.fontSize": 14,
5+
"editor.fontLigatures": true,
6+
"eslint.format.enable": true,
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.eslint": "explicit"
9+
},
10+
"files.eol": "\n",
11+
"files.trimTrailingWhitespace": true,
12+
"files.insertFinalNewline": true,
13+
"javascript.validate.enable": true,
14+
"typescript.validate.enable": true,
15+
"eslint.validate": ["javascript"],
16+
"npm.packageManager": "pnpm",
17+
"terminal.integrated.defaultProfile.linux": "zsh",
18+
"terminal.integrated.profiles.linux": {
19+
"zsh": {
20+
"path": "/bin/zsh"
2521
}
22+
},
23+
"workbench.sideBar.location": "right",
24+
"workbench.editor.enablePreview": false,
25+
"workbench.editor.enablePreviewFromQuickOpen": false
2626
}

.zshrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ZSH_THEME="powerlevel10k/powerlevel10k"
6868
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
6969
# Example format: plugins=(rails git textmate ruby lighthouse)
7070
# Add wisely, as too many plugins slow down shell startup.
71-
plugins=(git docker httpie node npm nvm z yarn pnpm colorize dotenv zsh-syntax-highlighting zsh-autosuggestions fzf)
71+
plugins=(git docker httpie node npm nvm z yarn colorize dotenv zsh-syntax-highlighting zsh-autosuggestions)
7272

7373
# NVM Initialization
7474
# The nvm plugin for Oh My Zsh might also handle this, but explicit initialization is safer.
@@ -133,4 +133,4 @@ alias nt='npm test'
133133
alias ns='npm start'
134134
alias nd='npm run dev'
135135

136-
alias bell="echo \"\a\""
136+
alias bell="echo \"\a\""

install.sh

100644100755
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/usr/bin/env zsh
22

33
function installDependencies() {
4-
echo "Installing Oh My Zsh..."
5-
# Install Oh My Zsh
6-
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended --keep-zshrc
4+
5+
# Check if Oh My Zsh is already installed
6+
if [ -d "${ZSH:-$HOME/.oh-my-zsh}" ]; then
7+
echo "Oh My Zsh already installed. Skipping installation."
8+
else
9+
echo "Installing Oh My Zsh..."
10+
# Install Oh My Zsh
11+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended --keep-zshrc
12+
fi
713

814
echo "Cloning Oh My Zsh plugins..."
915
# Clone Oh My Zsh plugins
@@ -75,13 +81,13 @@ function doIt() {
7581
fi
7682

7783
if [ "$1" != "-u" ]; then
78-
installDependencies;
84+
installDependencies || echo "⚠️ installDependencies failed, continuing..."
7985
fi
8086

81-
configureZsh;
82-
configureGit;
83-
configureVim;
84-
configureVSCode;
87+
configureZsh || echo "⚠️ configureZsh failed, continuing..."
88+
configureGit || echo "⚠️ configureGit failed, continuing..."
89+
configureVim || echo "⚠️ configureVim failed, continuing..."
90+
configureVSCode || echo "⚠️ configureVSCode failed, continuing..."
8591
echo "✅ Done. Restart your terminal or source your ~/.zshrc file."
8692
}
8793

0 commit comments

Comments
 (0)