{"id":14063814,"url":"https://github.com/jjcarrier/PS-TableUI","last_synced_at":"2025-07-29T16:32:04.459Z","repository":{"id":182097524,"uuid":"667628547","full_name":"jjcarrier/PS-TableUI","owner":"jjcarrier","description":"A simple PowerShell UI for working with selections of objects","archived":false,"fork":false,"pushed_at":"2024-10-20T17:19:19.000Z","size":329,"stargazers_count":9,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-21T22:56:43.130Z","etag":null,"topics":["module","powershell","table","ui"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jjcarrier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-18T00:39:03.000Z","updated_at":"2024-10-20T16:11:57.000Z","dependencies_parsed_at":"2023-07-18T18:37:36.474Z","dependency_job_id":"245bab3b-9529-443c-b9d5-07f9119981bb","html_url":"https://github.com/jjcarrier/PS-TableUI","commit_stats":null,"previous_names":["jjcarrier/ps-tableui"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjcarrier%2FPS-TableUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjcarrier%2FPS-TableUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjcarrier%2FPS-TableUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjcarrier%2FPS-TableUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jjcarrier","download_url":"https://codeload.github.com/jjcarrier/PS-TableUI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228028621,"owners_count":17858419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["module","powershell","table","ui"],"created_at":"2024-08-13T07:03:31.357Z","updated_at":"2024-12-04T01:31:31.553Z","avatar_url":"https://github.com/jjcarrier.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"# TableUI PowerShell Module\r\n\r\n[![pwsh version](https://img.shields.io/powershellgallery/v/TableUI)](https://www.powershellgallery.com/packages/TableUI)\r\n[![pwsh platform](https://img.shields.io/powershellgallery/p/TableUI)](https://www.powershellgallery.com/packages/TableUI)\r\n[![pwsh downloads](https://img.shields.io/powershellgallery/dt/TableUI)](https://www.powershellgallery.com/packages/TableUI)\r\n\r\n## Description\r\n\r\nThis is a simple, no frills UI that accepts an array of objects and displays\r\neach entry in an interactive list where the user can make selections for an\r\nunderlying operation.\r\n\r\n\u003e [!NOTE]\r\n\u003e The original scope of this tool was to provide a simple UI for selecting what\r\n upgradable packages to install for `winget update` but has been expanded on\r\n to be more general purpose. There is likely room for improvement.\r\n\r\n## Installation\r\n\r\nDownload/install the module from [PSGallery](https://www.powershellgallery.com/packages/TableUI):\r\n\r\n```pwsh\r\nInstall-Module -Name TableUI -Repository PSGallery\r\n```\r\n\r\nAdd the module to your `$PROFILE`:\r\n\r\n```pwsh\r\nImport-Module TableUI\r\n```\r\n\r\n\u003e [!NOTE]\r\n\u003e This UI uses ANSI escape sequences which may not be supported by all terminals.\r\n For Windows installations, the latest version of `Windows Terminal` is recommended.\r\n\r\n## Usage\r\n\r\n`Show-TableUI` is __intended__ to be used with arrays of `PSCustomObject`.\r\nIt is __not intended__ to be used with an array of dictionaries.\r\n\r\nFor example __use__ this form (specifying `[PSCustomObject]`):\r\n\r\n```pwsh\r\n$tableData = @(\r\n  [PSCustomObject]@{Name = 'Test A'; Version = '1.2.3'},\r\n  [PSCustomObject]@{Name = 'Test B'; Version = '1.2.5'}\r\n)\r\n```\r\n\r\nAnd __avoid__ this form:\r\n\r\n```pwsh\r\n$tableData = @(\r\n  @{Name = 'Test A'; Version = '1.2.3'},\r\n  @{Name = 'Test B'; Version = '1.2.5'}\r\n)\r\n```\r\n\r\nThis cmdlet works great with `ConvertFrom-` cmdlets, such as `ConvertFrom-Json`\r\nwhere the data conveys an array of objects with its fields as `NoteProperties`.\r\n\r\nBelow is an example showing type handling across multiple columns, additional\r\nparameters such as `-SelectedItemMembersToShow` can be added as needed.\r\n\r\n```pwsh\r\n$tableData = @(\r\n  [PSCustomObject]@{Name = 'Example Test Data A'; Version = '1.2.3'; Date = [DateTime]::Now; Guid = (New-Guid); Rev = 1; Latest = $false; Options = @('A', 'B', 'C', 'D', 'E') },\r\n  [PSCustomObject]@{Name = 'Example Test Data B'; Version = '1.2.4'; Date = [DateTime]::Now; Guid = (New-Guid); Rev = 12; Latest = $false },\r\n  [PSCustomObject]@{Name = 'Example Test Data C'; Version = '1.2.5'; Date = [DateTime]::Now; Guid = (New-Guid); Rev = 123; Latest = $false; Options = @('B', 'C') },\r\n  [PSCustomObject]@{Name = 'Example Test Data D'; Version = '1.2.6'; Date = [DateTime]::Now; Guid = (New-Guid); Rev = 1234; Latest = $false },\r\n  [PSCustomObject]@{Name = 'Example Test Data E'; Version = '1.2.7'; Date = [DateTime]::Now; Guid = (New-Guid); Rev = 12345; Latest = $false },\r\n  [PSCustomObject]@{Name = 'Example Test Data F'; Version = '1.2.8'; Date = [DateTime]::Now; Guid = (New-Guid); Rev = 123456; Latest = $true }\r\n)\r\n\r\n$selections = @()\r\nShow-TableUI -Table $tableData -Selections ([ref]$selections) -DefaultMemberToShow @('Name', 'Version', 'Rev', 'Latest', 'Options', 'Guid', 'Date')\r\n```\r\n\r\n![Test Example](img/test-ui.png)\r\n\r\nHere is an example of interfacing `winget update` with TableUI utilizing\r\n`ConvertFrom-TextTable` module (also available in [PSGallery](https://www.powershellgallery.com/packages/TextTable)).\r\nThis example specifies multiple members for `DefaultMemberToShow`. This results\r\nin multiple columns being rendered in the UI for the associated UI. The first\r\nmember is always given priority, if it cannot fit within the UI, the right-most\r\ncolumns will be dropped to make space for it. A visual indicator is used to\r\nindicate that the table is not showing all columns in the UI (via the use of\r\nvertical double-bars on the right side of the UI).\r\n\r\n```pwsh\r\nInstall-Module -Name TextTable -Repository PSGallery\r\nImport-Module TextTable\r\n\r\n$selections = @()\r\n$tableData = winget update | ConvertFrom-TextTable\r\n$tableData | Show-TableUI -DefaultMemberToShow Name,Available -Selections ([ref]$selections) -Title 'Available Updates'\r\n```\r\n\r\n\u003e [!NOTE]\r\n\u003e By default an array of Booleans is assigned to the value specified for\r\n  `-Selections`. This behavior can be changed to store `Indices` or\r\n  `Items` via the `-SelectionFormat` parameter. However, please note, that\r\n  this is a final transformation of the data. While the UI is processing this\r\n  request the underlying logic always utilizes an array of Booleans. It is\r\n  only at the conclusion of the operation that this variable is updated to\r\n  the desired form.\r\n\r\n![WinGet Example](img/winget-update-ui.png)\r\n\r\n## Selection Details Script Block\r\n\r\nA custom handler may be defined for the `ENTER` key by specifying the\r\n`-EnterKeyScript` parameter.\r\n\r\nThe assigned script block takes two parameters.\r\n\r\nThe first parameter is the array indicating the current selections (passed by\r\nvalue).\r\n\r\nThe second parameter is the currently selected index. Full access to the\r\ncurrently selected object and other selections may be realized with appropriate\r\nscoping.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjcarrier%2FPS-TableUI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjjcarrier%2FPS-TableUI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjcarrier%2FPS-TableUI/lists"}