PowerShell / PowerShell/PSResourceGet
Improve default list and table view of `Get-PSScriptFileInfo`
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 576
- Forks
- 114
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 7
Description
Summary of the new feature / enhancement
Testing out beta 22 manually downloaded from PowerShellGallery ( https://www.powershellgallery.com/packages/PSResourceGet ), I noticed that the default list view of Get-PSSCriptFileInfo was pretty useless.
Sample input
# Assets
$ScriptName = [string] 'Upload-WindowsAutopilotDeviceInfo'
$ScriptInstallDirectory = [string] [System.IO.Path]::Combine($env:LOCALAPPDATA,'Microsoft','PowerShell','Scripts')
$ScriptPath = [string] [System.IO.Path]::Combine($ScriptInstallDirectory,('{0}.ps1' -f $ScriptName))
# Save script if not already installed
if (-not [System.IO.File]::Exists($ScriptPath)) {
$null = Save-PSResource -Repository 'PSGallery' -TrustRepository -IncludeXml `
-SkipDependencyCheck -Path $ScriptInstallDirectory -Name $ScriptName
}
# Get script info
## Dont to anything with output -> Shows no info, only objects. Uses default list view?
Get-PSScriptFileInfo -Path $ScriptPath
## Default table view - Shows no info, only objects
Get-PSScriptFileInfo -Path $ScriptPath | Format-Table
## Default list view - Shows no info, only objects
Get-PSScriptFileInfo -Path $ScriptPath | Format-List
# Get some useful output manually
Get-PSScriptFileInfo -Path $ScriptPath | Select-Object -Property (
'Name',
@{'Name'='Version';'Expression'={[System.Version]$_.'ScriptMetadataComment'.'Version'}},
@{'Name'='Author';'Expression'={[string]$_.'ScriptMetadataComment'.'Author'}},
@{'Name'='Description';'Expression'={[string]$_.'ScriptHelpComment'.'Description'}}
) | Format-List
Output
PS C:\Users\redacted> Get-PSScriptFileInfo -Path ('{0}\Microsoft\PowerShell\Scripts\Get-WindowsAutoPilotInfo.ps1' -f $env:LOCALAPPDATA)
Name : Get-WindowsAutoPilotInfo
ScriptMetadataComment : Microsoft.PowerShell.PSResourceGet.UtilClasses.PSScriptMetadata
ScriptHelpComment : Microsoft.PowerShell.PSResourceGet.UtilClasses.PSScriptHelp
ScriptRequiresComment : Microsoft.PowerShell.PSResourceGet.UtilClasses.PSScriptRequires
ScriptContent : Microsoft.PowerShell.PSResourceGet.UtilClasses.PSScriptContents
PS C:\Users\redacted>
Proposed technical implementation details (optional)
Implement a default list view that makes sense.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Get-PSScriptFileInfo command and compare its direct output with the Format-Table and Format-List examples in the issue. Done means all three invocation styles display useful script metadata instead of only object type names, while preserving the metadata shown by the manual Select-Object example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100