diff --git a/README.md b/README.md index cac2d71..ecc5c3b 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,6 @@ And it takes 15-30 min, so make sure to grab your favourite tea or coffee meanwh # Install oh-my-zsh (it restarts shell, so it has to be separate) sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -# Main installation script +# Main installation script (make sure you use `zsh` to run the script, otherwise you'll run into weird errors) zsh ./install.sh -``` \ No newline at end of file +``` diff --git a/install.sh b/install.sh index 116ea6c..8884b78 100644 --- a/install.sh +++ b/install.sh @@ -12,8 +12,8 @@ echo '✅ Brew installation complete \n' echo '▶️ Installing Apps with Brew...' brew bundle # Configure Google Cloud CLI $PATH and autocomplete -source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc" -source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" +echo 'source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"' >> ~/.zshrc +echo 'source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"' >> ~/.zshrc echo '✅ Apps installation complete \n' echo '▶️ Installing Node.js via NVM...' @@ -29,11 +29,9 @@ echo '✅ Node.js installation complete \n' echo '▶️ Configuring custom Spy4x theme for Oh-my-zsh...' cd "$script_dir" -cp -R oh-my-zsh-theme/* ~/.oh-my-zsh/custom/ -echo 'ZSH_THEME="spy4x"' >> ~/.zshrc +cp my.zsh-theme ~/.oh-my-zsh/themes/ +echo 'ZSH_THEME="my"' >> ~/.zshrc echo 'source $ZSH/oh-my-zsh.sh' >> ~/.zshrc -mkdir ~/projects && cd ~/projects -echo 'cd ~/projects' >> ~/.zshrc # Set ~/projects as default dir to open in terminal source ~/.zshrc echo '✅ Configuration complete \n' diff --git a/my.zsh-theme b/my.zsh-theme new file mode 100644 index 0000000..76dcdb2 --- /dev/null +++ b/my.zsh-theme @@ -0,0 +1,27 @@ +# oh-my-zsh theme + +# Example of the look: +# +# ~/projects/project-name master firebase-project-id gcp-project-id +# $ +# + +local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' +local current_dir='$fg[green]%}%~%{$reset_color%}' +local git_branch='$(git_prompt_info)%{$reset_color%}' + +# Get Firebase Project ID or Alias that is associated with current folder +local firebase_project=%{$fg[yellow]%}'$(grep \"$(pwd)\" ~/.config/configstore/firebase-tools.json | cut -d" " -f2 | tr -d "\"" | tr -d ",")'%{$reset_color%} + +# Get Google Cloud Project ID that is currently selected +local gcp_project=%{$fg[cyan]%}'$(gcloud config get-value project 2> /dev/null)'%{$reset_color%} + +PROMPT="${current_dir} ${git_branch} ${firebase_project} ${gcp_project} +$ " +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$terminfo[bold]" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + +alias yu="yarn upgrade-interactive --latest" +alias gst="git status -sb" diff --git a/oh-my-zsh-theme/getFirebaseProject.js b/oh-my-zsh-theme/getFirebaseProject.js deleted file mode 100644 index de435a2..0000000 --- a/oh-my-zsh-theme/getFirebaseProject.js +++ /dev/null @@ -1,9 +0,0 @@ -const { readFileSync } = require(`fs`); -const folderPath = process.argv[2]; -try { - const pathToFirebaseToolsJson = `${process.env.HOME}/.config/configstore/firebase-tools.json`; - const fileContent = readFileSync(pathToFirebaseToolsJson); - const firebaseToolsJson = JSON.parse(fileContent); - const firebaseProjectName = firebaseToolsJson.activeProjects[folderPath]; - firebaseProjectName && console.log(`${firebaseProjectName} `); -} catch (error) {} diff --git a/oh-my-zsh-theme/spy4x.zsh-theme b/oh-my-zsh-theme/spy4x.zsh-theme deleted file mode 100644 index a71cc3d..0000000 --- a/oh-my-zsh-theme/spy4x.zsh-theme +++ /dev/null @@ -1,14 +0,0 @@ -local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' -local current_dir='%{$terminfo[bold]$fg[green]%}%~%{$reset_color%}' -local git_branch='$(git_prompt_info)%{$reset_color%}' -local firebase_project=%{$fg[cyan]%}'$(node ~/.oh-my-zsh/custom/getFirebaseProject.js $(pwd))'%{$reset_color%} - -PROMPT="${current_dir} ${firebase_project}${git_branch} -$ " -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - -alias yu="yarn upgrade-interactive --latest" -alias gst="git status -sb"