chocolatey / chocolatey/choco

Convert PowerShell helper functions to C#

Open
#3,477 9 comments 2 reactions 1 assignee Claimed by @Windos View on GitHub
1 - Ready Breaking Change ClickUp - Focus Enhancement
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [X] I have verified this is the correct repository for opening this issue.
- [X] I have verified no other issues exist related to my request.

### Is Your Feature Request Related To A Problem? Please describe.

Within the Chocolatey Licensed Extension, we extend the functionality that is provided by some of the Chocolatey PowerShell functions, for example for the [Package Throttle](https://docs.chocolatey.org/en-us/features/package-throttle/) feature, which means changing how the Get-WebFile function works.

Extending this functionality can be problematic as it deals with switching between PowerShell and C#, and there are no direct entry points to provide this additional functionality.

### Describe The Solution. Why is it needed?

We should convert all the Chocolatey PowerShell Functions, i.e. the `Install-ChocolateyPath.ps1` to be a C# CmdLets.

This will allow for better inheritance/overloading of Chocolatey functionality within things like the Chocolatey Licensed Extension, as well as providing the necessary entry points to extend the functionality as/when required.

In addition, this will prevent duplication of code between Chocolatey CLI and CLE.

### Additional Context

N/A

### Related Issues

- https://github.com/chocolatey/choco/issues/3318
- https://github.com/chocolatey/docs/issues/1074

### Tasks
- [ ] #3539
- [ ] Format-FileSize.ps1
- [x] Get-CheckSumValid.ps1 - https://github.com/chocolatey/choco/pull/3525
- [x] Get-ChocolateyConfigValue.ps1 - https://github.com/chocolatey/choco/pull/3663
- [x] Get-ChocolateyPath.ps1 - https://github.com/chocolatey/choco/pull/3646
- [ ] Get-ChocolateyUnzip.ps1
- [ ] Get-ChocolateyWebFile.ps1
- [x] Get-EnvironmentVariable.ps1
- [x] Get-EnvironmentVariableNames.ps1
- [ ] Get-FtpFile.ps1
- [ ] Get-OSArchitectureWidth.ps1
- [ ] Get-PackageParameters.ps1
- [ ] Get-ToolsLocation.ps1
- [ ] Get-UACEnabled.ps1
- [ ] Get-UninstallRegistryKey.ps1
- [ ] Get-VirusCheckValid.ps1
- [ ] Get-WebFile.ps1
- [ ] Get-WebFileName.ps1
- [ ] Install-BinFile.ps1
- [ ] Install-ChocolateyEnvironmentVariable.ps1
- [ ] Install-ChocolateyExplorerMenuItem.ps1
- [ ] Install-ChocolateyFileAssociation.ps1
- [ ] Install-ChocolateyInstallPackage.ps1
- [ ] Install-ChocolateyPackage.ps1
- [x] Install-ChocolateyPath.ps1
- [ ] Install-ChocolateyPinnedTaskBarItem.ps1
- [ ] Install-ChocolateyPowerShellCommand.ps1
- [ ] Install-ChocolateyShortcut.ps1
- [ ] Install-ChocolateyVsixPackage.ps1
- [ ] Install-Vsix.ps1
- [x] Set-EnvironmentVariable.ps1
- [ ] Set-PowerShellExitCode.ps1
- [ ] Start-ChocolateyProcessAsAdmin.ps1
- [x] Test-ProcessAdminRights.ps1
- [ ] Uninstall-BinFile.ps1
- [ ] Uninstall-ChocolateyEnvironmentVariable.ps1
- [ ] Uninstall-ChocolateyPackage.ps1
- [ ] Uninstall-ChocolateyZipPackage.ps1
- [x] Update-SessionEnvironment.ps1
- [x] Write-FunctionaCallLogMessage.ps1
- [ ] Before next release: ensure all associated docs PRs (https://github.com/chocolatey/docs/issues/1074) are merged
- [ ] Before next release: ensure we update the `Chocolatey.PowerShell.dll-help.xml` external help file in this repository after the docs PRs are merged

┆Issue is synchronized with this [Clickup task](https://app.clickup.com/t/868ky0h7v) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.