Skip to content

Commit 578403d

Browse files
author
FriedrichWeinmann
committed
stuff
1 parent ee5b116 commit 578403d

20 files changed

+332
-47
lines changed

PSModuleDevelopment/PSModuleDevelopment.psd1

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22

33
# Script module or binary module file associated with this manifest
4-
ModuleToProcess = 'PSModuleDevelopment.psm1'
4+
RootModule = 'PSModuleDevelopment.psm1'
55

66
# Version number of this module.
77
ModuleVersion = '1.4.0.27'
@@ -41,7 +41,7 @@
4141

4242
# Modules that must be imported into the global environment prior to importing
4343
# this module
44-
RequiredModules = @("PSFramework")
44+
RequiredModules = @(@{ ModuleName='PSFramework'; ModuleVersion='0.9.4.9' })
4545

4646
# Assemblies that must be loaded prior to importing this module
4747
RequiredAssemblies = @('bin\PSModuleDevelopment.dll')
@@ -54,7 +54,7 @@
5454
TypesToProcess = @()
5555

5656
# Format files (.ps1xml) to be loaded when importing this module
57-
FormatsToProcess = @()
57+
FormatsToProcess = @('xml\PSModuleDevelopment.Format.ps1xml')
5858

5959
# Modules to import as nested modules of the module specified in
6060
# ModuleToProcess
@@ -64,17 +64,19 @@
6464
FunctionsToExport = @(
6565
'Expand-PSMDTypeName',
6666
'Find-PSMDFileContent',
67-
'Get-HelpEx',
68-
'Get-ModuleDebug',
69-
'Import-ModuleDebug',
70-
'Measure-CommandEx',
67+
'Get-PSMDAssembly',
68+
'Get-PSMDConstructor',
69+
'Get-PSMDHelpEx',
70+
'Get-PSMDModuleDebug',
71+
'Import-PSMDModuleDebug',
72+
'Measure-PSMDCommandEx',
7173
'New-PSMDHeader',
7274
'New-PSMDFormatTableDefinition',
7375
'New-PssModuleProject',
74-
'Remove-ModuleDebug',
76+
'Remove-PSMDModuleDebug',
7577
'Rename-PSMDParameter',
7678
'Restart-PSMDShell',
77-
'Set-ModuleDebug',
79+
'Set-PSMDModuleDebug',
7880
'Set-PSMDCmdletBinding',
7981
'Set-PSMDModulePath',
8082
'Set-PSMDParameterHelp',
@@ -90,7 +92,6 @@
9092
# Aliases to export from this module
9193
AliasesToExport = @(
9294
'find',
93-
'Get-ExHelp',
9495
'hex',
9596
'Restart-Shell',
9697
'rss',

PSModuleDevelopment/PSModuleDevelopment.psproj

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
<File Build="2" Shared="True" ReferenceFunction="Invoke-preload_ps1">internal\scripts\preload.ps1</File>
2828
<File Build="2" Shared="True" ReferenceFunction="Invoke-postload_ps1">internal\scripts\postload.ps1</File>
2929
<File Build="2" Shared="True" ReferenceFunction="Invoke-Restart-PSMDShell_ps1">functions\utility\Restart-PSMDShell.ps1</File>
30-
<File Build="2" Shared="True" ReferenceFunction="Invoke-Set-ModuleDebug_ps1">functions\moduledebug\Set-ModuleDebug.ps1</File>
31-
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-ModuleDebug_ps1">functions\moduledebug\Get-ModuleDebug.ps1</File>
32-
<File Build="2" Shared="True" ReferenceFunction="Invoke-Remove-ModuleDebug_ps1">functions\moduledebug\Remove-ModuleDebug.ps1</File>
33-
<File Build="2" Shared="True" ReferenceFunction="Invoke-Import-ModuleDebug_ps1">functions\moduledebug\Import-ModuleDebug.ps1</File>
34-
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-HelpEx_ps1">functions\help\Get-HelpEx.ps1</File>
35-
<File Build="2" Shared="True" ReferenceFunction="Invoke-Measure-CommandEx_ps1">functions\performance\Measure-CommandEx.ps1</File>
30+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Set-PSMDModuleDebug_ps1">functions\moduledebug\Set-PSMDModuleDebug.ps1</File>
31+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-PSMDModuleDebug_ps1">functions\moduledebug\Get-PSMDModuleDebug.ps1</File>
32+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Remove-PSMDModuleDebug_ps1">functions\moduledebug\Remove-PSMDModuleDebug.ps1</File>
33+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Import-PSMDModuleDebug_ps1">functions\moduledebug\Import-PSMDModuleDebug.ps1</File>
34+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-PSMDHelpEx_ps1">functions\help\Get-PSMDHelpEx.ps1</File>
35+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Measure-PSMDCommandEx_ps1">functions\performance\Measure-PSMDCommandEx.ps1</File>
3636
<File Build="2" Shared="False" ReferenceFunction="Invoke-New-PssModuleProject_ps1">functions\utility\New-PssModuleProject.ps1</File>
3737
<File Build="2">en-us\about_psmoduledevelopment.help.txt</File>
3838
<File Build="2" Shared="False" ReferenceFunction="Invoke-Set-PSMDModulePath_ps1">functions\utility\Set-PSMDModulePath.ps1</File>
@@ -54,6 +54,10 @@
5454
<File Build="2" Shared="True" ReferenceFunction="Invoke-New-PSMDHeader_ps1">functions\utility\New-PSMDHeader.ps1</File>
5555
<File Build="2" Shared="True" ReferenceFunction="Invoke-Find-PSMDFileContent_ps1">functions\utility\Find-PSMDFileContent.ps1</File>
5656
<File Build="2" Shared="True" ReferenceFunction="Invoke-utility_ps1">internal\configurations\utility.ps1</File>
57+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-PSMDConstructor_ps1">functions\assembly\Get-PSMDConstructor.ps1</File>
58+
<File Build="2">xml\PSModuleDevelopment.Format.ps1xml</File>
59+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-PSMDAssembly_ps1">functions\assembly\Get-PSMDAssembly.ps1</File>
60+
<File Build="2" Shared="True" ReferenceFunction="Invoke-Find-PSMDType_ps1">functions\assembly\Find-PSMDType.ps1</File>
5761
</Files>
5862
<StartupScript>F:\Synchronized Data\Scripte\Powershell Studio\Projects\PSModuleDevelopment\Test-Module.ps1</StartupScript>
5963
</Project>
Binary file not shown.
Binary file not shown.

PSModuleDevelopment/bin/PSModuleDevelopment.xml

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function Find-PSMDType
2+
{
3+
[CmdletBinding()]
4+
Param (
5+
6+
)
7+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
function Get-PSMDAssembly
2+
{
3+
<#
4+
.SYNOPSIS
5+
Returns the assemblies currently loaded.
6+
7+
.DESCRIPTION
8+
Returns the assemblies currently loaded.
9+
10+
.PARAMETER Filter
11+
Default: *
12+
The name to filter by
13+
14+
.EXAMPLE
15+
Get-PSMDAssembly
16+
17+
Lists all imported libraries
18+
19+
.EXAMPLE
20+
Get-PSMDAsssembly -Filter "Microsoft.*"
21+
22+
Lists all imported libraries whose name starts with "Microsoft.".
23+
#>
24+
[CmdletBinding()]
25+
Param (
26+
[string]
27+
$Filter = "*"
28+
)
29+
30+
[appdomain]::CurrentDomain.GetAssemblies() | Where-Object FullName -Like $Filter
31+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
function Get-PSMDConstructor
2+
{
3+
<#
4+
.SYNOPSIS
5+
Returns information on the available constructors of a type.
6+
7+
.DESCRIPTION
8+
Returns information on the available constructors of a type.
9+
Accepts any object as pipeline input:
10+
- if it's a type, it will retrieve its constructors.
11+
- If it's not a type, it will retrieve the constructor from the type of object passed
12+
13+
Will not duplicate constructors if multiple objects of the same type are passed.
14+
In order to retrieve the constructor of an array, wrap it into another array.
15+
16+
.PARAMETER InputObject
17+
The object the constructor of which should be retrieved.
18+
19+
.EXAMPLE
20+
Get-ChildItem | Get-PSMDConstructor
21+
22+
Scans all objects in the given path, than tries to retrieve the constructor for each kind of object returned
23+
(generally, this will return the constructors for file and folder objects)
24+
25+
.EXAMPLE
26+
Get-PSMDConstructor $result
27+
28+
Returns the constructors of objects stored in $result
29+
#>
30+
[CmdletBinding()]
31+
Param (
32+
[Parameter(ValueFromPipeline = $true)]
33+
$InputObject
34+
)
35+
36+
begin
37+
{
38+
$processedTypes = @()
39+
}
40+
process
41+
{
42+
foreach ($item in $InputObject)
43+
{
44+
if ($item -eq $null) { continue }
45+
if ($item -is [System.Type]) { $type = $item }
46+
else { $type = $item.GetType() }
47+
48+
if ($processedTypes -contains $type) { continue }
49+
50+
foreach ($constructor in $type.GetConstructors())
51+
{
52+
New-Object PSModuleDevelopment.PsmdAssembly.Constructor($constructor)
53+
}
54+
55+
$processedTypes += $type
56+
}
57+
}
58+
end
59+
{
60+
61+
}
62+
}

PSModuleDevelopment/functions/help/Get-HelpEx.ps1 renamed to PSModuleDevelopment/functions/help/Get-PSMDHelpEx.ps1

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Function Get-HelpEx
1+
Function Get-PSMDHelpEx
22
{
33
<#
44
.SYNOPSIS
55
Displays localized information about Windows PowerShell commands and concepts.
66
77
.DESCRIPTION
8-
The Get-HelpEx function is a wrapper around get-help that allows localizing help queries.
8+
The Get-PSMDHelpEx function is a wrapper around get-help that allows localizing help queries.
99
This is especially useful when developing modules with help in multiple languages.
1010
1111
.PARAMETER Category
@@ -23,7 +23,7 @@
2323
This parameter is effective only when help files are for the command are installed on the computer. It has no effect on displays of conceptual ("About_") help.
2424
2525
.PARAMETER Examples
26-
Displays only the name, synopsis, and examples. To display only the examples, type "(Get-HelpEx <cmdlet-name>).Examples".
26+
Displays only the name, synopsis, and examples. To display only the examples, type "(Get-PSMDHelpEx <cmdlet-name>).Examples".
2727
2828
This parameter is effective only when help files are for the command are installed on the computer. It has no effect on displays of conceptual ("About_") help.
2929
@@ -110,7 +110,7 @@
110110
This parameter is introduced in Windows PowerShell 3.0.
111111
112112
.EXAMPLE
113-
PS C:\> Get-HelpEx Get-Help "en-us" -Detailed
113+
PS C:\> Get-PSMDHelpEx Get-Help "en-us" -Detailed
114114
115115
Gets the detailed help text of Get-Help in English
116116
@@ -175,16 +175,16 @@
175175

176176
Begin
177177
{
178-
if ($PSBoundParameters.ContainsKey("SetLanguage")) { $script:set_language = $SetLanguage }
179-
if ($PSBoundParameters.ContainsKey("Language"))
178+
if (Test-PSFParameterBinding -ParameterName "SetLanguage") { $script:set_language = $SetLanguage }
179+
if (Test-PSFParameterBinding -ParameterName "Language")
180180
{
181181
try { [System.Threading.Thread]::CurrentThread.CurrentUICulture = $Language }
182-
catch { Write-Warning "Failed to set language: $($_.Exception.Message)" }
182+
catch { Write-PSFMessage -Level Warning -Message "Failed to set language" -ErrorRecord $_ -Tag 'fail','language' }
183183
}
184184
elseif ($script:set_language)
185185
{
186186
try { [System.Threading.Thread]::CurrentThread.CurrentUICulture = $script:set_language }
187-
catch { Write-Warning "Failed to set language: $($_.Exception.Message)" }
187+
catch { Write-PSFMessage -Level Warning -Message "Failed to set language" -ErrorRecord $_ -Tag 'fail', 'language' }
188188
}
189189

190190
# Prepare Splat for splatting a steppable pipeline
@@ -212,5 +212,4 @@
212212
catch { throw }
213213
}
214214
}
215-
New-Alias -Name Get-ExHelp -Value Get-HelpEx -Scope Global -Option AllScope
216-
New-Alias -Name hex -Value Get-HelpEx -Scope Global -Option AllScope
215+
New-Alias -Name hex -Value Get-PSMDHelpEx -Scope Global -Option AllScope

PSModuleDevelopment/functions/moduledebug/Get-ModuleDebug.ps1 renamed to PSModuleDevelopment/functions/moduledebug/Get-PSMDModuleDebug.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function Get-ModuleDebug
1+
function Get-PSMDModuleDebug
22
{
33
<#
44
.SYNOPSIS
@@ -12,7 +12,7 @@
1212
A string filter applied to the module name. All modules of matching name (using a -Like comparison) will be returned.
1313
1414
.EXAMPLE
15-
PS C:\> Get-ModuleDebug -Filter *net*
15+
PS C:\> Get-PSMDModuleDebug -Filter *net*
1616
1717
Returns the module debugging configuration for all modules with a name that contains "net"
1818

0 commit comments

Comments
 (0)