Created
September 28, 2019 12:58
-
-
Save pizycki/d7cdf517e8af7de7a3dd8f2b7fc41f9a to your computer and use it in GitHub Desktop.
Creates gitignore file
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
| function New-GitIgnore { | |
| param( | |
| [switch] $All = $false, | |
| [switch] $VisualStudio = $false, | |
| [switch] $VisualStudioCode = $false, | |
| [switch] $Rider = $false, | |
| [switch] $InteliJ = $false | |
| ) | |
| $url = "https://gitignore.io/api/" | |
| $originalUrlLength = $url.Length | |
| if($All -or $VisualStudio) { $url = $url + "visualstudio," } | |
| if($All -or $VisualStudioCode) { $url = $url + "visualstudiocode," } | |
| if($All -or $InteliJ) { $url = $url + "intellij+all," } | |
| if($All -or $Rider) { $url = $url + "rider," } | |
| $url = $url.TrimEnd(',') | |
| if($url.Length -eq $originalUrlLength){ | |
| Write-Host -ForegroundColor Yellow "You must provide at least one option to generate gitignore file." | |
| return | |
| } | |
| $exp = "wget `"$($url)`" -OutFile .gitignore." | |
| Write-Host $exp | |
| Invoke-Expression $exp | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment