Skip to content

Commit

Permalink
Merge pull request #264 from StartAutomating/Posh-Presentation
Browse files Browse the repository at this point in the history
Posh 0.1.7: Posh Presentation
  • Loading branch information
StartAutomating committed Sep 7, 2023
2 parents 9b552c8 + a6b2036 commit 126ab97
Show file tree
Hide file tree
Showing 40 changed files with 1,879 additions and 98 deletions.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/FeatureRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ body:
attributes:
value: |
Tell us a little bit about what you'd like.
- type: textarea
id: Description
attributes:
label: Description
description: Describe your dream feature.
validations:
required: true

17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## Posh 0.1.7: Posh Presentation

* New and Improved Formatting:
* Get-Member formatting - Highlighting PowerShell Members (#226)
* Adding Formatting for PSMemberInfo (#246)
* Adding Formatting for MeasureInfo (#247)
* New Blogs
* PowerShell Weekly (#255)
* Host Improvements
* Adding Posh.Host.Cursor (#134, #135, #243, #244, #245, #248, #249, #250, #251, #252, #253, #259, #261)
* Prompt Improvements
* Improving stackable functions (#138) (thanks @mdgrs !)
* Posh.Prompt Tests (#256)
* Adding PSModuleInfo.get_README (#263)

---

## Posh 0.1.6: Posh Reflection

* Added multiple custom views for System.Type (#216):
Expand Down
28 changes: 28 additions & 0 deletions Formatting/MeasureInfo.format.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Write-FormatView -TypeName Microsoft.PowerShell.Commands.GenericMeasureInfo, Microsoft.PowerShell.Commands.TextMeasureInfo -Action {
Write-FormatViewExpression -ScriptBlock {
$visibleProperties =
@(foreach ($property in $_.psobject.properties) {
if ($null -ne $property.Value) {
$property
}
})

$longest = 0
$visibleProperties.Name.Foreach({
if ($_.Length -gt $longest) {
$longest = $_.Length
}
})

@(foreach ($visibleProperty in $visibleProperties) {
$visibleProperty.Name.PadRight($longest, ' ') +
' : ' +
$visibleProperty.Value
}) -join [Environment]::NewLine
}
}
Write-FormatView -TypeName Microsoft.PowerShell.Commands.GenericMeasureInfo -Property Count, Average, Sum, Maximum, Minimum, StandardDeviation, Property -AutoSize -Name All

Write-FormatView -TypeName Microsoft.PowerShell.Commands.GenericMeasureInfo -Property Minimum,Maximum -AutoSize -Name MinMax

Write-FormatView -TypeName Microsoft.PowerShell.Commands.TextMeasureInfo -Property Lines, Words, Characters -AutoSize
10 changes: 8 additions & 2 deletions Formatting/MemberDefinition.format.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
$colorNameAndMemberType =
{

@(
if ($_.MemberType -notin 'Method','Property','ParemeterizedProperty') {
"Italic"
}
if ($_.MemberType -like '*property*') {
"Foreground.Green", "Bold"
"Foreground.Green"
"Bold"
}
elseif ($_.MemberType -like '*method' -or $_.MemberType -eq 'Event') {
"Formatting.Warning"
}
})
}

Write-FormatView -TypeName Microsoft.PowerShell.Commands.MemberDefinition -Property Name, MemberType, Definition -StyleProperty @{
Expand Down
25 changes: 25 additions & 0 deletions Formatting/PSMemberInfo.format.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
$colorNameAndMemberType =
{

@(
if ($_.MemberType -notin 'Method','Property','ParemeterizedProperty') {
"Italic"
}
if ($_.MemberType -like '*property*') {
"Foreground.Green"
"Bold"
}
elseif ($_.MemberType -like '*method' -or $_.MemberType -eq 'Event') {
"Formatting.Warning"
})
}

Write-FormatView -TypeName System.Management.Automation.PSMemberInfo Name, MemberType, IsInstance, Value -StyleProperty @{
Name = $colorNameAndMemberType
MemberType = $colorNameAndMemberType
}

Write-FormatView -TypeName System.Management.Automation.PSMemberInfo Name, MemberType, IsInstance, Value -Wrap -Name Wrap -StyleProperty @{
Name = $colorNameAndMemberType
MemberType = $colorNameAndMemberType
}
4 changes: 4 additions & 0 deletions Formatting/Posh/Posh.Host.Cursor.format.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Write-FormatView -TypeName Posh.Host.Cursor -Property "Position.Row", "Position.Column" -VirtualProperty @{
"Position.Row" = { $_.Position.Row }
"Position.Column" = { $_.Position.Column }
}
Loading

0 comments on commit 126ab97

Please sign in to comment.