-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed resolving of path to support PSDrives #61
base: master
Are you sure you want to change the base?
Changes from 4 commits
10a3386
dd05462
a40599f
247ebb0
bf7ca11
8e98841
9cc8a58
89bf09d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function Get-FullPath ([string]$Path) { | ||
# https://github.com/pester/Pester/blob/5796c95e4d6ff5528b8e14865e3f25e40f01bd65/Functions/TestResults.ps1#L13-L27 | ||
$Folder = Split-Path -Path $Path -Parent | ||
$File = Split-Path -Path $Path -Leaf | ||
if ( -not ([String]::IsNullOrEmpty($Folder))) { | ||
$FolderResolved = Resolve-Path -Path $Folder | ||
} | ||
else { | ||
$FolderResolved = Resolve-Path -Path $ExecutionContext.SessionState.Path.CurrentFileSystemLocation | ||
} | ||
$Path = Join-Path -Path $FolderResolved.ProviderPath -ChildPath $File | ||
|
||
return $Path | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
function Get-ModuleFunctions { | ||
function Get-ModuleFunctions | ||
{ | ||
<# | ||
.SYNOPSIS | ||
List functions imported by a module | ||
|
@@ -27,6 +28,7 @@ function Get-ModuleFunctions { | |
[cmdletbinding()] | ||
param( | ||
[parameter(ValueFromPipeline = $True)] | ||
[ValidateNotNullOrEmpty()] | ||
[Alias('Path')] | ||
[string]$Name | ||
) | ||
|
@@ -41,19 +43,19 @@ function Get-ModuleFunctions { | |
$params = @{ | ||
Force = $True | ||
Passthru = $True | ||
Name = $Name | ||
Name = Get-FullPath $Name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here - I assume this will always be a path, but comment based help could use a tweak to avoid confusion (i.e. it's not either a name or path, it's a path and only a path)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't follow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh sorry! To clarify, for all of these, they're used with |
||
} | ||
|
||
# Create a runspace, add script to run | ||
$PowerShell = [Powershell]::Create() | ||
[void]$PowerShell.AddScript({ | ||
Param ($Force, $Passthru, $Name) | ||
Import-Module -Name $Name -PassThru:$Passthru -Force:$Force | ||
Param ($Force, $Passthru, $Name) | ||
Import-Module -Name $Name -PassThru:$Passthru -Force:$Force | ||
|
||
}).AddParameters($Params) | ||
}).AddParameters($Params) | ||
|
||
( $PowerShell.Invoke() ).ExportedFunctions.Keys | ||
|
||
$PowerShell.Dispose() | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this will always be a path, but comment based help could use a tweak to avoid confusion (i.e. it's not either a name or path, it's a path and only a path)?