The first wins on points of assumed knowledge, and runs on WinPS But if you weren't limited to that, are other possibilities interesting?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Collections | |
using namespace System.Collections.Generic | |
using namespace System.Management | |
using namespace System.Management.Automation | |
using namespace System.Management.Automation.Language | |
function New.CompletionResult { | |
[Alias('New.CR')] | |
param( | |
# original base text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Collections.Generic | |
# $PSStyle.OutputRendering = 'Ansi' | |
@' | |
I used winget as a quick example case. | |
if you're doing more with it, check out the export as json and detailed logging options | |
https://learn.microsoft.com/en-us/windows/package-manager/winget/troubleshooting | |
https://learn.microsoft.com/en-us/windows/package-manager/winget/export#exporting-files | |
'@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Collections.Generic | |
Function InvokeGrep { | |
<# | |
.SYNOPSIS | |
wraps the native command RipGrep | |
#> | |
param( | |
[string]$Pattern, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter Expand-Property { | |
<# | |
.SYNOPSIS | |
Expands an array property, creating a duplicate object for each value | |
.EXAMPLE | |
[PSCustomObject]@{ Name = "A"; Value = @(1,2,3) } | Expand-Property Value | |
Name Value | |
---- ----- | |
A 1 |
Write-LogMessage Verbose -Message 'stuff' -Json @{ 'user' = 'bob'; id = 100 }
function New-SafeFileTimeNowString {
<#
.SYNOPSIS
timenow for safe filepaths: "2022-08-17_12-46-47Z"
.notes