You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-5Lines changed: 17 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ The commands in this module have been developed to make it easier to automate th
10
10
+[Fun with PowerShell Module Layout](https://jdhitsolutions.com/blog/powershell/8731/fun-with-powershell-module-layout/)
11
11
+[Building a PowerShell Module Inception-Style](https://jdhitsolutions.com/blog/powershell/8741/building-a-powershell-module-inception-style/)
12
12
13
-
This module has been written for PowerShell 7.1 and later. It is most likely that the the commands will work in Windows PowerShell, but you will need to fork this module and revise as necessary. Otherwise, install this module from the PowerShell Gallery.
13
+
This module has been written for **PowerShell 7.1** and later. It is most likely that the the commands will work in Windows PowerShell, but you will need to fork this module and revise as necessary. Otherwise, install this module from the PowerShell Gallery.
14
14
15
15
```powershell
16
16
Install-Module PSFunctionTools
@@ -23,17 +23,19 @@ To see a summary of these commands at any time, run [Get-PSFunctionTools](docs/G
23
23
```dos
24
24
PS C:\> Get-PSFunctionTools
25
25
26
-
Module: PSFunctionTools [v0.6.0]
26
+
Module: PSFunctionTools [v1.0.0]
27
27
28
28
Name Alias Synopsis
29
29
---- ----- --------
30
30
Convert-ScriptToFunction csf Convert a script file to a PowerShell funct…
31
31
Export-FunctionFromFile eff Export a PowerShell function from a script …
32
+
Export-FunctionToFile etf Export a PowerShell function to a file.
32
33
Export-ModuleLayout eml Export a model module layout.
33
-
Format-FunctionName Format a function name to proper case.
34
+
Format-FunctionName ffn Format a function name to proper case.
34
35
Get-FunctionAlias {ga, gfal} Get a defined function alias.
35
36
Get-FunctionAttribute gfa Get function attributes like cmdletbinding.
36
-
Get-FunctionName Identify the names of PowerShell functions …
37
+
Get-FunctionName gfn Identify the names of PowerShell functions …
38
+
Get-FunctionProfile gfp Get a technical summary of a PowerShell fun…
37
39
Get-ModuleLayout Get information about a module layout file.
38
40
Get-ParameterBlock gpb Get a function's parameter block.
39
41
Get-PSFunctionTools Get a summary of PSFunctionTools commands.
@@ -42,7 +44,7 @@ Import-ModuleLayout iml Create a module structure from a layout fil
42
44
New-CommentHelp nch Create comment based help.
43
45
New-ModuleFromFiles Create a PowerShell module from a set of fi…
44
46
New-ModuleFromLayout Creat a new module based on a layout.
45
-
Test-FunctionName Test the validity of a PowerShell function …
47
+
Test-FunctionName tfn Test the validity of a PowerShell function …
If you run this command in the PowerShell ISE or the VS Code integrated PowerShell Terminal, you can use the dynamic parameter `Remove` to delete the function from the source file.
You +can use this command to export a function which is loaded into your PowerShell session. You might need to do this when you create an ad-hoc function and want to save it to a file. This command will take the content of the function and export it to a ps1 file. The function name will be used for the file name. Although, characters like the colon will be stripped to create a filesystem-compatibale filename.
Use `Export-ModuleLayout` to export a model module directory structure to a json file. You can use `Import-ModuleLayout` to recreate the layout from the json file. The export process will include not only directories, but also text files like a readme or license file.
You can use this command to export a function which is loaded into your PowerShell session. You might need to do this when you create an ad-hoc function and want to save it to a file. This command will take the content of the function and export it to a ps1 file. The function name will be used for the file name. Although, characters like the colon will be stripped to create a filesystem-compatibale filename.
Export the New-FileLInk function to a file and specify runtime requirements.
47
+
48
+
## PARAMETERS
49
+
50
+
### -Confirm
51
+
52
+
Prompts you for confirmation before running the cmdlet.
53
+
54
+
```yaml
55
+
Type: SwitchParameter
56
+
Parameter Sets: (All)
57
+
Aliases: cf
58
+
59
+
Required: False
60
+
Position: Named
61
+
Default value: None
62
+
Accept pipeline input: False
63
+
Accept wildcard characters: False
64
+
```
65
+
66
+
### -Name
67
+
68
+
Specify the name of a function loaded in your PowerShell session.
69
+
70
+
```yaml
71
+
Type: String
72
+
Parameter Sets: (All)
73
+
Aliases:
74
+
75
+
Required: True
76
+
Position: 0
77
+
Default value: None
78
+
Accept pipeline input: True (ByValue)
79
+
Accept wildcard characters: False
80
+
```
81
+
82
+
### -Passthru
83
+
84
+
Show the file result.
85
+
86
+
```yaml
87
+
Type: SwitchParameter
88
+
Parameter Sets: (All)
89
+
Aliases:
90
+
91
+
Required: False
92
+
Position: Named
93
+
Default value: None
94
+
Accept pipeline input: False
95
+
Accept wildcard characters: False
96
+
```
97
+
98
+
### -Path
99
+
100
+
Specify the location for the new file. The function name will be used for the file name, stripping off any characters that invalid filename characters.
101
+
102
+
```yaml
103
+
Type: String
104
+
Parameter Sets: (All)
105
+
Aliases:
106
+
107
+
Required: False
108
+
Position: Named
109
+
Default value: None
110
+
Accept pipeline input: False
111
+
Accept wildcard characters: False
112
+
```
113
+
114
+
### -Requires
115
+
116
+
Specify #Requires statements, including the #
117
+
118
+
```yaml
119
+
Type: String[]
120
+
Parameter Sets: (All)
121
+
Aliases:
122
+
123
+
Required: False
124
+
Position: Named
125
+
Default value: None
126
+
Accept pipeline input: False
127
+
Accept wildcard characters: False
128
+
```
129
+
130
+
### -WhatIf
131
+
132
+
Shows what would happen if the cmdlet runs.
133
+
The cmdlet is not run.
134
+
135
+
```yaml
136
+
Type: SwitchParameter
137
+
Parameter Sets: (All)
138
+
Aliases: wi
139
+
140
+
Required: False
141
+
Position: Named
142
+
Default value: None
143
+
Accept pipeline input: False
144
+
Accept wildcard characters: False
145
+
```
146
+
147
+
### CommonParameters
148
+
149
+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
150
+
151
+
## INPUTS
152
+
153
+
### System.String
154
+
155
+
## OUTPUTS
156
+
157
+
### None
158
+
159
+
### System.IO.FileInfo
160
+
161
+
## NOTES
162
+
163
+
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
0 commit comments