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: ChangeLog.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,15 @@
1
1
# ChangeLog for PSFunctionInfo
2
2
3
+
## 1.0.0
4
+
5
+
+ Restructured module layout.
6
+
+ Added a property set called `TagInfo`.
7
+
+ Added command `Edit-PSFunctionInfo` with an alias of `efpi`. ([Issue #7](https://github.com/jdhitsolutions/PSFunctionInfo/issues/7))
8
+
+ Added better error handling to `Get-PSFunctionInfo` where function can't be found.
9
+
+ Help updates.
10
+
+ First official release to the PowerShell Gallery.
11
+
+ Updated `README.md`.
12
+
3
13
## 0.6.0-preview
4
14
5
15
+ Fixed the `-Name` parameter argument completer in `Get-PSFunctionInfo`. The function parameter changed from `Name` to `FunctionName` which is why it broke. ([Issue #6](https://github.com/jdhitsolutions/PSFunctionInfo/issues/6))
Copy file name to clipboardExpand all lines: README.md
+23-19Lines changed: 23 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@
4
4
5
5
## Synopsis
6
6
7
+

8
+
7
9
This module contains a set of PowerShell commands to add and manage metadata in stand-alone PowerShell functions.
8
10
9
11
## Installation
@@ -18,19 +20,19 @@ The module should work on both Windows PowerShell and PowerShell 7.x, even cross
18
20
19
21
## Description
20
22
21
-
The purpose of this code is to provide a way to get versioning and other metadata information for functions that may not belong to a module. This is information you want to get after the function has been loaded into your PowerShell session. I have numerous stand-alone functions. These functions don't belong to a module, so there is no version or source information. However, I'd like to use that type of information for non-module files.
23
+
The purpose of this code is to provide a way to get versioning and other metadata information for functions that do not belong to a module. This is information you want to get after the function has been loaded into your PowerShell session. I have numerous stand-alone functions. These functions don't belong to a module, so there is no version or source information. However, I'd like to have that type of information for non-module functions.
22
24
23
-
The code in this module isn't concerned with loading, running, or finding functions. By default, [Get-PSFunctionInfo](docs/Get-PSFunctionInfo.md) queries whatever is in the `Function:` PSDrive. If the PowerShell function belongs to a module, then you'll get the module version and source. Otherwise, you can use the function metadata.
25
+
The code in this module isn't concerned with loading, running, or finding functions. By default, [Get-PSFunctionInfo](docs/Get-PSFunctionInfo.md) queries whatever is in the `Function:` PSDrive. If the PowerShell function belongs to a module, then you'll get the module version and source. Otherwise, the command will use the function metadata.
24
26
25
-

27
+

26
28
27
29
The default behavior is to show all functions that __don't__ belong to a module.
You can also get functions by tag. Use `Get-PSFunctionInfoTag` to get a list of tags currently in use.
33
+
You can also get currently loaded functions by tag. Use `Get-PSFunctionInfoTag` to get a list of tags currently in use.
32
34
33
-

35
+

34
36
35
37
The PSFunctionInfo object includes a PropertySet called `AuthorInfo`.
36
38
@@ -50,12 +52,12 @@ LastUpdate : 4/23/2021 9:21:00 AM
50
52
Or you can use the `TagInfo` property set. This gives you the same result as using the `tag` named view with `Format-Table`.,
51
53
52
54
```powershell
53
-
Get-psfunctioninfo | Select-object taginfo
55
+
Get-PSFunctionInfo | Select-Object taginfo
54
56
```
55
57
56
58
Finally, you can also search .ps1 files for PSFunctionInfo metadata.
57
59
58
-

60
+

59
61
60
62
## Creating PSFunctionInfo
61
63
@@ -65,7 +67,7 @@ Use the [New-PSFunctionInfo](docs/New-PSFunctionInfo.md) command to insert the m
65
67
New-PSFunctionInfo -Path c:\scripts\Test-ConsoleColors.ps1 -Description "show console color combinations" -Name Test-ConsoleColor -Author "Jeff Hicks" -CompanyName "JDH IT Solutions" -Copyright "2021 JDH IT Solutions, Inc." -Tags "scripting","console"
66
68
```
67
69
68
-
The default behavior is to insert the metadata tag immediately after the opening brace ({) into the file. **This command will update the file**. Or you can use the `ToClipBoard` parameter which will copy the metatadata to the clipboard and you can manually insert it into your script file that defines the function.
70
+
The default behavior is to insert the metadata tag immediately after the opening brace (`{`) into the file. **This command will update the file**. Or you can use the `ToClipBoard` parameter which will copy the metatadata to the clipboard. You can then manually insert it into your script file that defines the function. You should avoid changing the formatting of the comment block.
There are no commands to modify or remove function metadata. It is assumed that when you update the function, you can update or remove the metadata.
119
+
Currently, there are no commands to modify or remove function metadata. It is assumed that when you update the function, you can update or remove the metadata.
118
120
119
121
### Backup
120
122
121
-
Because creating a PSFunctionInfo metadata comment block modifies the file, you might feel safer with a backup. `New-PSFunctionInfo` has a `-BackupParameter` which will create a backup copy of the source file before inserting the metadata comment block. The file will be created in the same directory, appending an extension of .bak1. If there are previous backups, the number will increment, i.e. .bak2. You have to manually delete the backup files.
123
+
Because creating a PSFunctionInfo metadata comment block modifies the file, you might feel safer with a file backup. `New-PSFunctionInfo` has a `-BackupParameter` which will create a backup copy of the source file before inserting the metadata comment block. The file will be created in the same directory, appending an extension of .bak1. If there are previous backups, the number will increment, i.e. .bak2. You have to manually delete the backup files.
122
124
123
125
The `-Backup` parameter has no effect if you use `-Clipboard`.
124
126
@@ -142,23 +144,23 @@ When you import the module into an editor, you will get additional features to m
142
144
143
145
If you have an open file, in the integrated PowerShell console, you can run `New-PSFunctionfo` and press <kbd>TAB</kbd> to tab-complete the detected functions in the current file. The file path will automatically be detected. You can enter other values such as version, or simply press <kbd>ENTER</kbd> to insert the metadata, which you can then edit.
This example is taking advantage of saved defaults.
148
150
149
151
### PowerShell ISE
150
152
151
153
When you import the module in the PowerShell ISE, it will add a menu shortcut.
152
154
153
-

155
+

154
156
155
157
With a loaded file, you could run `New-PSFunctionInfo` in the console specifying the function name. The Path will be auto-detected. Or use the menu shortcut which will give you a graphical "function picker"
Select a function and click <kbd>OK</kbd>. The metadata block will be inserted into the file. This will not work with a file that has unsaved changes. When you insert new function metadata, the file in the ISE will be closed, re-opened, and focus should jump to the function.
160
162
161
-

163
+

162
164
163
165
### Editing Source Files
164
166
@@ -176,7 +178,7 @@ Or pipe to it.
176
178
Get-PSFunctionInfo Get-QOTD | Edit-PSFunctionInfo -editor ise
177
179
```
178
180
179
-
Once opened, you will need to navigate to the function and metadata section.
181
+
Once opened, you will need to navigate to the appropriate function and metadata section.
180
182
181
183
## Background
182
184
@@ -187,5 +189,7 @@ This module was first described at <https://jdhitsolutions.com/blog/powershell/8
187
189
## Roadmap
188
190
189
191
+ Add function metadata by file, autodetecting the function name.
192
+
+ Consider a bulk editing command.
193
+
+ Consider a bulk removal command to clean PSFunctionInfo metadata from files.
0 commit comments