script-modules/OpenSolution.psm1
function Open-Solution { [Alias('sln')] param ( [string]$RootDirectory = $PWD ) $solutions = Get-ChildItem -Recurse -Path $RootDirectory -Filter "*.sln" if ($solutions.Count -eq 1) { Invoke-Item $solutions.FullName } elseif ($solutions.Count -eq 0) { Write-Host "I couldn't find any solution files here!" -ForegroundColor Red } elseif ($solutions.Count -gt 1) { Write-Host "I found more than 1 solution. Which one do you want to open?" -ForegroundColor Yellow $solutions | Format-Table @{ Label="Solutions"; Expression={" --> $_"} } } } Export-ModuleMember -Function * -Alias * |