{"id":25306751,"url":"https://github.com/mitchcapper/systempathgroups","last_synced_at":"2025-04-07T06:29:35.560Z","repository":{"id":277062415,"uuid":"931194959","full_name":"mitchcapper/SystemPathGroups","owner":"mitchcapper","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-12T01:41:06.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T08:35:24.188Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitchcapper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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},"funding":{"github":"mitchcapper"}},"created_at":"2025-02-11T21:44:06.000Z","updated_at":"2025-02-12T01:41:09.000Z","dependencies_parsed_at":"2025-02-11T23:34:45.478Z","dependency_job_id":"0897c067-306a-452a-865d-d75a9e6d078d","html_url":"https://github.com/mitchcapper/SystemPathGroups","commit_stats":null,"previous_names":["mitchcapper/systempathgroups"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchcapper%2FSystemPathGroups","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchcapper%2FSystemPathGroups/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchcapper%2FSystemPathGroups/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchcapper%2FSystemPathGroups/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchcapper","download_url":"https://codeload.github.com/mitchcapper/SystemPathGroups/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247605091,"owners_count":20965538,"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":[],"created_at":"2025-02-13T10:39:42.046Z","updated_at":"2025-04-07T06:29:35.530Z","avatar_url":"https://github.com/mitchcapper.png","language":"PowerShell","funding_links":["https://github.com/sponsors/mitchcapper"],"categories":[],"sub_categories":[],"readme":"\u003c!-- README.md is auto generated by Build-Readme.ps1 do not update it manually --\u003e\n# SystemPathGroups\n\n[![Build and Test](https://github.com/mitchcapper/SystemPathGroups/actions/workflows/build.yaml/badge.svg)](https://github.com/mitchcapper/SystemPathGroups/actions/workflows/build.yaml)\n\nPowerShell module for managing grouped paths in Windows PATH environment variable.  This was developed for the Github Actions Runner team to hopefully encourage them to implement better practices to avoid path pollution.  At runner build time all the Paths are added to the system path var using `Add-ToPath` which then would allow for an easy github action that the user could use to either remove all default paths and add specific ones (best practice) or at least remove problematic ones from the path.  This was mostly generated by GitHub Co-pilot / Aider.\n\n## Table Of Contents\n\u003c!-- MarkdownTOC --\u003e\n- [Simple Example](#simple-example)\n- [Features](#features)\n- [Configuration](#configuration)\n- [Installation](#installation)\n- [Cmdlet Reference](#cmdlet-reference)\n\t- [Add-ToPath](#add-topath)\n\t\t- [Syntax](#syntax)\n\t\t- [Description](#description)\n\t\t- [Parameters](#parameters)\n\t\t- [Examples](#examples)\n\t\t\t- [EXAMPLE 1](#example-1)\n\t\t\t- [EXAMPLE 2](#example-2)\n\t\t\t- [EXAMPLE 3](#example-3)\n\t\t\t- [EXAMPLE 4](#example-4)\n\t- [Add-PathGroupsToPath](#add-pathgroupstopath)\n\t\t- [Syntax](#syntax-1)\n\t\t- [Description](#description-1)\n\t\t- [Parameters](#parameters-1)\n\t\t- [Examples](#examples-1)\n\t\t\t- [EXAMPLE 1](#example-1-1)\n\t\t\t- [EXAMPLE 2](#example-2-1)\n\t- [Remove-PathGroupsFromPath](#remove-pathgroupsfrompath)\n\t\t- [Syntax](#syntax-2)\n\t\t- [Description](#description-2)\n\t\t- [Parameters](#parameters-2)\n\t\t- [Examples](#examples-2)\n\t\t\t- [EXAMPLE 1](#example-1-2)\n\t\t\t- [EXAMPLE 2](#example-2-2)\n\t\t\t- [EXAMPLE 3](#example-3-1)\n\u003c!-- /MarkdownTOC --\u003e\n\n## Simple Example\nDuring initial platform image build add python and msys path options to the known path configuration, by default these are added to the system path too\n```powershell\nAdd-ToPath -PathGroup Python -NewPath c:\\python312\nAdd-ToPath -PathGroup Python -NewPath $env:LOCALAPPDATA\\Programs\\Python\\Python312\\Scripts\nAdd-ToPath -PathGroup MSYS64 -NewPath c:\\msys64\\ucrt64\\bin\nAdd-ToPath -PathGroup MSYS64Nightly -NewPath c:\\msys64-nightly\\ucrt64\\bin -AddToSystemPath $false\n```\n\nThen users could call:\n```powershell\nRemove-PathGroupsFromPath\nAdd-PathGroupsToPath Python MSYS64Nightly\n```\nWhich would remove all known groups from the path by default and only add the ones the user cares about.\n\nOtherwise if they just want to remove one problematic package in the default system path:\n```powershell\nRemove-PathGroupsFromPath MSYS64\n```\n\n## Features\n- Group-based path management\n- Persistent path configuration storage\n- Support for paths with spaces and special characters\n- Case-preserving path handling\n- Forward/backward slash normalization\n- Handles duplicate path prevention\n\n## Configuration\n- Paths are stored in: $env:ProgramData\\SystemPathGroups\\paths.json\n\n\n## Installation\n\n```powershell\nInstall-Module -Name SystemPathGroups\n```\n\n\n## Cmdlet Reference\n\n### Add-ToPath\n\nAdds a new path to both to the known paths configuration and optionally to the system path (true by default).\n\n#### Syntax\n\n```powershell\nAdd-ToPath\n```\n#### Description\n\nThis function adds a specified path to the paths configuration file with an associated path group. \nIf AddToSystemPath is true (default), also adds the path to the system path.\nIf AddToSystemPath is false, the path will only be saved to the configuration file.\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n|PathGroup|String|The group name to associate with the path in the configuration file.|\n|NewPath|String|The file system path to add.|\n|AddToSystemPath|Boolean|Optional. If true (default), adds the path to system path. If false, only stores in config.|\n\n#### Examples\n##### EXAMPLE 1\n```powershell\nAdd-ToPath \"DevTools\" \"C:\\Tools\\bin\"\n```\nAdds C:\\Tools\\bin to the system path and associates it with the \"DevTools\" group.    \n\n##### EXAMPLE 2\n```powershell\nAdd-ToPath -PathGroup \"DevTools\" -NewPath \"C:\\Tools\\bin\"\n```\nSame as above using named parameters.    \n\n##### EXAMPLE 3\n```powershell\nAdd-ToPath \"DevTools\" \"C:\\Tools\\bin\" $false\n```\nOnly adds C:\\Tools\\bin to the configuration file without modifying the system path.    \n\n##### EXAMPLE 4\n```powershell\nAdd-ToPath -PathGroup \"DevTools\" -NewPath \"C:\\Tools\\bin\" -AddToSystemPath $false\n```\nSame as above using named parameters.    \n\n### Add-PathGroupsToPath\n\nAdds paths associated with specified path groups to the system path.\n\n#### Syntax\n\n```powershell\nAdd-PathGroupsToPath\n```\n#### Description\n\nThis function adds paths to the system path environment variable based on their associated path groups\nfrom the paths configuration file. If no path groups are specified, all paths from the configuration will be added.\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n|PathGroups|String[]|An optional array of path group names. If specified, only paths associated with these groups will be added.\nIf not specified, all paths from the configuration will be added.|\n\n#### Examples\n##### EXAMPLE 1\n```powershell\nAdd-PathGroupsToPath -PathGroups \"DevTools\",\"TestTools\"\n```\nAdds all paths associated with the \"DevTools\" and \"TestTools\" groups to the system path.    \n\n##### EXAMPLE 2\n```powershell\nAdd-PathGroupsToPath\n```\nAdds all paths from the configuration file to the system path.    \n\n### Remove-PathGroupsFromPath\n\nRemoves paths associated with specified path groups from the system path.\n\n#### Syntax\n\n```powershell\nRemove-PathGroupsFromPath\n```\n#### Description\n\nThis function removes paths from the system path environment variable based on their associated path groups.\nIf no path groups are specified, all paths from the configuration will be removed.\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n|PathGroups|String[]|An optional array of path group names. If specified, only paths associated with these groups will be removed.\nIf not specified, all paths from the configuration will be removed. Can be specified as multiple arguments.|\n\n#### Examples\n##### EXAMPLE 1\n```powershell\nRemove-PathGroupsFromPath \"DevTools\",\"TestTools\"\n```\nRemoves all paths associated with the \"DevTools\" and \"TestTools\" groups from the system path.    \n\n##### EXAMPLE 2\n```powershell\nRemove-PathGroupsFromPath \"DevTools\" \"TestTools\"\n```\nSame as above, but using multiple arguments instead of an array.    \n\n##### EXAMPLE 3\n```powershell\nRemove-PathGroupsFromPath\n```\nRemoves all paths from the system path that are defined in the configuration file.\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchcapper%2Fsystempathgroups","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchcapper%2Fsystempathgroups","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchcapper%2Fsystempathgroups/lists"}