Functions/Publish-MyModule.ps1
function Publish-MyModule { [CmdletBinding()] param ( [Parameter()] [ArgumentCompleter( { param ( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters ) Get-ChildItem "$($env:USERPROFILE)\Git\$wordToComplete*" -Directory -Name | ForEach-Object { "`"$_`"" } } )] [string] $Module ) $NugetApiKeyFile = "$([Environment]::GetFolderPath("MyDocuments"))\WindowsPowerShell\NugetApikey.txt" if (Test-Path $NugetApiKeyFile) { $NugetApiKey = Get-Content $NugetApiKeyFile } else { Write-Warning "NugetApiKeyFile not found at: `"$($NugetApiKeyFile)`"" break } # $Path = (Get-Item (Get-Module $Module -ListAvailable).Path).Directory.Fullname $Path = "$($env:USERPROFILE)\Git\$($Module)" Publish-Module -Path $Path -NuGetApiKey $NugetApiKey # Publish-Module -Path 'C:\Users\jterlouw\OneDrive - RAM Infotechnology\Documenten\WindowsPowerShell\Modules\TestmodulePSGallery\' -NuGetApiKey "oy2c75vxjgj5nm7kwzeaov7xlnbve64uhgr7yjdrz6u7gy" Write-Host "https://www.powershellgallery.com/packages/$($Module)/" -ForegroundColor Yellow } |