Skip to content

Instantly share code, notes, and snippets.

@racecarparts
Created November 2, 2024 21:39
Show Gist options
  • Save racecarparts/5506b21a2befea726ef4311a08662115 to your computer and use it in GitHub Desktop.
Save racecarparts/5506b21a2befea726ef4311a08662115 to your computer and use it in GitHub Desktop.
Setup a new project with a devcontainer
#!/bin/bash
# Usage: ./setup_new_project.sh <project-name> <tag>
PROJECT_NAME=$1
TAG=${2:-v1.0} # Default to v1.0 if no tag is provided
# Check if project name is provided
if [ -z "$PROJECT_NAME" ]; then
echo "Please provide a project name."
exit 1
fi
# Create the project directory
mkdir "$PROJECT_NAME"
cd "$PROJECT_NAME" || exit
# Initialize a new git repository
git init
# Add rcp-devcontainer as a submodule at the specified tag
git submodule add https://github.com/racecarparts/rcp-devcontainer .devcontainer
cd .devcontainer || exit
git checkout "tags/$TAG"
cd ..
# Commit the submodule reference
git add .devcontainer
git commit -m "Add rcp-devcontainer submodule at $TAG"
echo "Project $PROJECT_NAME has been created with rcp-devcontainer at tag $TAG."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment