Skip to content

Instantly share code, notes, and snippets.

@daephx
Forked from colorqualia/gitignore.ps1
Last active November 12, 2022 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daephx/085e4a790796942f2535d3f96007eda8 to your computer and use it in GitHub Desktop.
Save daephx/085e4a790796942f2535d3f96007eda8 to your computer and use it in GitHub Desktop.
[New-Gitignore] Generate a new ignore file via 'gitignore.io'. #PowerShell
<#
.SYNOPSIS
Generate a new ignore file via 'gitignore.io'
.LINK
https://www.toptal.com/developers/gitignore
#>
#Requires -Version 3.0
Function New-Gitignore {
Param(
[Parameter(Mandatory)]
[string[]]$list
)
$params = $list -join ","
Invoke-WebRequest -Uri "http://gitignore.io/api/$params"
| Select-Object -ExpandProperty content
| Out-File -FilePath $(Join-Path -Path $pwd -ChildPath ".gitignore") -Encoding ascii
If ($?) { Write-Host "Created .gitignore for the following inputs`n$params" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment