run-module.ps1
# ---------------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/powershell@4.0.708) # Changes may cause incorrect behavior and will be lost if the code is regenerated. # ---------------------------------------------------------------------------------- param([switch]$NotIsolated, [switch]$Code) $ErrorActionPreference = 'Stop' if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } $isAzure = $false if($isAzure) { . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts # Load the latest version of Az.Accounts installed Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version } $localModulesPath = Join-Path $PSScriptRoot 'generated\modules' if(Test-Path -Path $localModulesPath) { $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" } $modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './CommvaultPowerShell.psd1') $modulePath = $modulePsd1.FullName $moduleName = $modulePsd1.BaseName function Prompt { Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" Write-Host -NoNewline -ForegroundColor Gray ' [' Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName ']> ' } # where we would find the launch.json file $vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') $launchJson = Join-Path $vscodeDirectory 'launch.json' # if there is a launch.json file, let's just assume -Code, and update the file if(($Code) -or (test-Path $launchJson) ) { $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' Set-Content -Path $launchJson -Value $launchContent if($Code) { # only launch vscode if they say -code code $PSScriptRoot } } Import-Module -Name $modulePath |