Last active
December 26, 2022 19:15
-
-
Save moritztim/759ee18e67b43811eb2136562fbfb0e6 to your computer and use it in GitHub Desktop.
Creates a git / github / vscode repo with a basic structure
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
function New-Repo { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory = $false)] | |
[string]$RepoName = "New Repo", | |
[Parameter(Mandatory = $false)] | |
[string]$License = "mit", | |
[Parameter(Mandatory = $false)] | |
[string]$RepoPath = "$env:UserProfile\Documents\GitHub", | |
) | |
$repoPath = "$RepoPath\$RepoName" | |
New-Item -ItemType Directory -Path $repoPath | Out-Null | |
Push-Location $repoPath | |
New-Item -ItemType Directory -Path "src" | Out-Null | |
New-Item -ItemType Directory -Path "doc" | Out-Null | |
New-Item -ItemType Directory -Path "test" | Out-Null | |
New-Item -ItemType Directory -Path "build" | Out-Null | |
Invoke-WebRequest "https://spdx.org/licenses/$License.txt" -OutFile "LICENSE" | |
Invoke-WebRequest "https://www.gitignore.io/api/visualstudiocode" -OutFile ".gitignore" | |
Add-Content ".gitignore" "build/" | |
New-Item -ItemType File -Path "README.md" | Out-Null | |
Invoke-Expression "git init" | |
Invoke-Expression "git add ." | |
Start-Process "code" "." | |
Pop-Location | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment