Created
November 2, 2024 21:39
-
-
Save racecarparts/5506b21a2befea726ef4311a08662115 to your computer and use it in GitHub Desktop.
Setup a new project with a devcontainer
This file contains hidden or 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
#!/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