Functions/Publish-MyModule.ps1


function Publish-MyModule {
    [CmdletBinding()]
    param (
        [Parameter()]
        [ArgumentCompleter( {
                param ( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters )
                Get-ChildItem "$([Environment]::GetFolderPath("MyDocuments"))\WindowsPowerShell\Modules\$wordToComplete*" -Directory -Name | ForEach-Object { "`"$_`"" } }
        )]
        [string]
        $Module
    )



    $NugetApiKeyFile = "$([Environment]::GetFolderPath("MyDocuments"))\WindowsPowerShell\NugetApikey.txt"
    if (Test-Path $NugetApiKeyFile) {
        $NugetApiKey = Get-Content $NugetApiKeyFile
    } else {
       break
    }

    $NugetApiKey

    $Path = (Get-Item (Get-Module $Module -ListAvailable).Path).Directory.Fullname

    Publish-Module -Path $Path -NuGetApiKey $NugetApiKey




    # Publish-Module -Path 'C:\Users\jterlouw\OneDrive - RAM Infotechnology\Documenten\WindowsPowerShell\Modules\TestmodulePSGallery\' -NuGetApiKey "oy2c75vxjgj5nm7kwzeaov7xlnbve64uhgr7yjdrz6u7gy"




}