Last active
April 6, 2024 19:04
-
-
Save Blumed/37998462f734e39e0a620158c7a748c5 to your computer and use it in GitHub Desktop.
Simple bash function for opening any repo in your git project directory using any editor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openWork() { | |
StartColor="\e[1;32m" | |
EndColor="\e[0m" | |
editor="code" # add command which opens files/dirs using your editor | |
workDirectory=(~/dev/) # add your path to your work directory | |
directories=($workDirectory*) | |
PS3="Enter the number associated with a directory you want to open with $editor? " | |
echo "There are ${StartColor}${#directories[@]}${EndColor} directories in ${StartColor}${workDirectory}${EndColor}:"; \ | |
select directory in "${directories[@]##*/}"; do echo "Opening ${StartColor}${directory}${EndColor}"' with '${StartColor}${editor}${EndColor}'!'; $editor $workDirectory${directory}; break; done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment