Skip to content

Instantly share code, notes, and snippets.

@GriffFerguson
Created August 15, 2022 17:02
Show Gist options
  • Save GriffFerguson/728d1725ce7b1fd44da0726b2213250c to your computer and use it in GitHub Desktop.
Save GriffFerguson/728d1725ce7b1fd44da0726b2213250c to your computer and use it in GitHub Desktop.
Open Projects in VSCode
#! /bin/bash
PROJ_DIR="Documents/Projects"
function project() {
cd ~
if [ $1 == "new" ]
then
echo "Creating project $2"
cd $PROJ_DIR
mkdir $2
echo "Project created; opening"
cd $2
code ./
else
echo "Opening project $1"
cd ~
cd $PROJ_DIR
cd "./$1"
code ./
fi
}
# USAGE:
# Change the variable "PROJ_DIR" to point to whatever folder your projects are stored in6
# in the file ".bashrc" (located in the "home" folder), add the following:
# SOURCE = <path-to-script>/openproject.sh
# Restart/open a terminal, and run the command "project" to use the script
#
# SYNTAX:
# Open a project: project <project folder name>
# Create a project: project new <project folder name>
# To use a subdirectory within the "PROJ_DIR" path, just
# add "<subdirectory>/" before the project folder name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment