Skip to content

Commit

Permalink
v2.47.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed May 25, 2023
1 parent 3b026f4 commit 8f89bca
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 172 deletions.
Binary file modified PSScriptTools.psd1
Binary file not shown.
12 changes: 6 additions & 6 deletions PSScriptTools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ if ($psEditor) {
if ($host.name -match 'Code') {

$context = $psEditor.GetEditorContext()
$thispath = $context.CurrentFile.Path
$target = Split-Path -Path $thispath
Write-Verbose "Using $thispath"
$ThisPath = $context.CurrentFile.Path
$target = Split-Path -Path $ThisPath
Write-Verbose "Using $ThisPath"
Write-Verbose "Changing to $target"
Set-Location -Path $target

Expand All @@ -134,7 +134,7 @@ if ($psEditor) {
}
}
} #VSCode
elseif ($psIse) {
elseif ($psISE) {
Write-Verbose 'Defining ISE additions'

if ($psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.DisplayName -NotContains 'ToDo') {
Expand All @@ -144,9 +144,9 @@ elseif ($psIse) {
$title = 'To Do'
$item = Invoke-InputBox -Title $title -Prompt $prompt
$todo = "# [$(Get-Date)] TODO: $item"
$psise.CurrentFile.Editor.InsertText($todo)
$psISE.CurrentFile.Editor.InsertText($todo)
#jump cursor to the end
$psise.CurrentFile.editor.SetCaretPosition($psise.CurrentFile.Editor.CaretLine, $psise.CurrentFile.Editor.CaretColumn)
$psISE.CurrentFile.editor.SetCaretPosition($psISE.CurrentFile.Editor.CaretLine, $psISE.CurrentFile.Editor.CaretColumn)
}
#add the action to the Add-Ons menu
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('ToDo', $Action, 'Ctrl+Alt+2' ) | Out-Null
Expand Down
Binary file added PSScriptToolsManual.pdf
Binary file not shown.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,12 @@ The output will only show native members, including static methods, but not thos

![static members](images/typemember-static.png)

The command will highlight properties that are enumerations.

![enum properties](images/typemember-enum.png)

The hightlighting only works in the console and VSCode.

The output includes a property set type extension.

```dos
Expand All @@ -1718,6 +1724,28 @@ AddMinutes System.DateTime False $obj.AddMinutes([Double]value)
...
```

Or you can use the custom view.

```dos
PS C:\> Get-TypeMember datetime -MemberType method | Format-Table -View Syntax
Type: System.DateTime
Name ReturnType Syntax
---- ---------- ------
Add DateTime $obj.Add([TimeSpan]value)
AddDays DateTime $obj.AddDays([Double]value)
AddHours DateTime $obj.AddHours([Double]value)
AddMilliseconds DateTime $obj.AddMilliseconds([Double]value)
AddMinutes DateTime $obj.AddMinutes([Double]value)
AddMonths DateTime $obj.AddMonths([Int32]months)
AddSeconds DateTime $obj.AddSeconds([Double]value)
AddTicks DateTime $obj.AddTicks([Int64]value)
AddYears DateTime $obj.AddYears([Int32]value)
...
```

### [New-PSDynamicParameter](docs/New-PSDynamicParameter.md)

This command will create the code for a dynamic parameter that you can insert into your PowerShell script file. You need to specify a parameter name and a condition. The condition value is code that would run inside an If statement. Use a value like $True if you want to add it later in your scripting editor.
Expand Down
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

This file contains the most recent change history for the PSScriptTools module.

## v2.47.0

### Changed

- Added missing online help links.
- Updated module description in the manifest.
- Added `EnableLN` parameter alias to `Get-FolderSizeInfo`.
- Help updates.
- Update `Get-TypeMember` to identify properties that are enumerations.
- Updated format file for `Get-TypeMember` to highlight enum properties.
- Updated `README.md`.

## v2.46.0

### Changed
Expand Down
40 changes: 20 additions & 20 deletions docs/Get-FolderSizeInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ Note that this command has been optimized for performance, but if you have a lot
```powershell
PS C:\> Get-FolderSizeInfo -Path d:\temp
Computername Path TotalFiles TotalSize
------------ ---- ---------- ---------
BOVINE320 D:\temp 48 121824451
Computername Path TotalFiles TotalSize
------------ ---- ---------- ---------
BOVINE320 D:\temp 48 121824451
```

### Example 2

```powershell
PS C:\> Get-FolderSizeInfo -Path d:\temp -hidden
Computername Path TotalFiles TotalSize
------------ ---- ---------- ---------
BOVINE320 D:\temp 146 125655552
Computername Path TotalFiles TotalSize
------------ ---- ---------- ---------
BOVINE320 D:\temp 146 125655552
```

Include hidden files.
Expand All @@ -54,19 +54,19 @@ PS C:\> Get-ChildItem d:\ -Directory | Get-FolderSizeInfo |
Where-Object TotalSize -gt 1MB | Sort-Object TotalSize -Descending |
Format-Table -View mb
Computername Path TotalFiles TotalSizeMB
------------ ---- ---------- -----------
BOVINE320 D:\VMDisks 18 114873.7246
BOVINE320 D:\ISO 17 42526.8204
BOVINE320 D:\SQLServer2017Media 1 710.8545
BOVINE320 D:\officeViewers 4 158.9155
BOVINE320 D:\Temp 48 116.1809
BOVINE320 D:\Sysinternals 153 59.6169
BOVINE320 D:\blog 41 21.9948
BOVINE320 D:\BackTemp 2 21.6734
BOVINE320 D:\rip 3 11.1546
BOVINE320 D:\logs 134 3.9517
BOVINE320 D:\2016 5 1.5608
Computername Path TotalFiles TotalSizeMB
------------ ---- ---------- -----------
BOVINE320 D:\VMDisks 18 114873.7246
BOVINE320 D:\ISO 17 42526.8204
BOVINE320 D:\SQLServer2017Media 1 710.8545
BOVINE320 D:\officeViewers 4 158.9155
BOVINE320 D:\Temp 48 116.1809
BOVINE320 D:\Sysinternals 153 59.6169
BOVINE320 D:\blog 41 21.9948
BOVINE320 D:\BackTemp 2 21.6734
BOVINE320 D:\rip 3 11.1546
BOVINE320 D:\logs 134 3.9517
BOVINE320 D:\2016 5 1.5608
```

Get the top-level directories from D and pipe them to Get-FolderSizeInfo. Items with a total size of greater than 1MB are sorted on the total size and then formatted as a table using a built-in view called MB which formats the total size in MB. There are also views named KB,GB and TB to display formatted results accordingly.
Expand Down Expand Up @@ -131,7 +131,7 @@ Enable support for long file and folder names. Read https://learn.microsoft.com/
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: lfn
Aliases: lfn,EnableLN

Required: False
Position: Named
Expand Down
113 changes: 62 additions & 51 deletions docs/Get-TypeMember.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSScriptTools-help.xml
Module Name: PSScriptTools
online version:
online version: https://bit.ly/3JVpGLB
schema: 2.0.0
---

Expand Down Expand Up @@ -45,59 +45,70 @@ The command in this module includes custom format and type extensions. See help
```powershell
PS C:\> Get-TypeMember DateTime
Type: System.DateTime
Name MemberType ResultType IsStatic
---- ---------- ---------- --------
MaxValue Field datetime True
MinValue Field datetime True
UnixEpoch Field datetime True
Add Method DateTime False
AddDays Method DateTime False
AddHours Method DateTime False
...
Date Property DateTime
Day Property Int32
DayOfWeek Property DayOfWeek
DayOfYear Property Int32
Hour Property Int32
...
Type: System.DateTime
Name MemberType ResultType IsStatic IsEnum
---- ---------- ---------- -------- ------
MaxValue Field datetime True
MinValue Field datetime True
Add Method DateTime
AddDays Method DateTime
AddHours Method DateTime
AddMilliseconds Method DateTime
AddMinutes Method DateTime
AddMonths Method DateTime
AddSeconds Method DateTime
...
Date Property DateTime
Day Property Int32
DayOfWeek Property DayOfWeek True
DayOfYear Property Int32
Hour Property Int32
Kind Property DateTimeKind True
Millisecond Property Int32
Minute Property Int32
...
```

Static items will be shown in green.
Static items will be shown in green. Enum properties will be shown in orange.

### EXAMPLE 2

```powershell
PS C:\> Get-TypeMember DateTime -StaticOnly
Type: System.DateTime
Name MemberType ResultType IsStatic
---- ---------- ---------- --------
MaxValue Field datetime True
MinValue Field datetime True
UnixEpoch Field datetime True
Compare Method Int32 True
DaysInMonth Method Int32 True
...
Type: System.DateTime
Name MemberType ResultType IsStatic IsEnum
---- ---------- ---------- -------- ------
MaxValue Field datetime True
MinValue Field datetime True
Compare Method Int32 True
DaysInMonth Method Int32 True
Equals Method Boolean True
FromBinary Method DateTime True
FromFileTime Method DateTime True
...
```

### EXAMPLE 3

```powershell
PS C:\> Get-TypeMember system.io.fileinfo -MemberType Property
Type: System.IO.FileInfo
Name MemberType ResultType IsStatic
---- ---------- ---------- --------
Attributes Property FileAttributes
CreationTime Property DateTime
CreationTimeUtc Property DateTime
Directory Property DirectoryInfo
DirectoryName Property String
...
Type: System.IO.FileInfo
Name MemberType ResultType IsStatic IsEnum
---- ---------- ---------- -------- ------
Attributes Property FileAttributes True
CreationTime Property DateTime
CreationTimeUtc Property DateTime
Directory Property DirectoryInfo
DirectoryName Property String
Exists Property Boolean
Extension Property String
FullName Property String
...
```

Get only properties for System.IO.FileInfo.
Expand All @@ -109,18 +120,18 @@ PS C:\> Get-TypeMember datetime -MemberName add* | Format-Table -view syntax
Type: System.DateTime
Name ReturnType Syntax
---- ---------- ------
Add DateTime $obj.Add(\[TimeSpan\]value)
AddDays DateTime $obj.AddDays(\[Double\]value)
AddHours DateTime $obj.AddHours(\[Double\]value)
AddMicroseconds DateTime $obj.AddMicroseconds(\[Double\]value)
AddMilliseconds DateTime $obj.AddMilliseconds(\[Double\]value)
AddMinutes DateTime $obj.AddMinutes(\[Double\]value)
AddMonths DateTime $obj.AddMonths(\[Int32\]months)
AddSeconds DateTime $obj.AddSeconds(\[Double\]value)
AddTicks DateTime $obj.AddTicks(\[Int64\]value)
AddYears DateTime $obj.AddYears(\[Int32\]value)
Name ReturnType Syntax
---- ---------- ------
Add DateTime $obj.Add(\[TimeSpan\]value)
AddDays DateTime $obj.AddDays(\[Double\]value)
AddHours DateTime $obj.AddHours(\[Double\]value)
AddMicroseconds DateTime $obj.AddMicroseconds(\[Double\]value)
AddMilliseconds DateTime $obj.AddMilliseconds(\[Double\]value)
AddMinutes DateTime $obj.AddMinutes(\[Double\]value)
AddMonths DateTime $obj.AddMonths(\[Int32\]months)
AddSeconds DateTime $obj.AddSeconds(\[Double\]value)
AddTicks DateTime $obj.AddTicks(\[Int64\]value)
AddYears DateTime $obj.AddYears(\[Int32\]value)
```

Use the custom table view to see method syntax.
Expand Down
Loading

0 comments on commit 8f89bca

Please sign in to comment.