Skip to content

Convert PowerShell Functions to C# CmdLets #3477

@gep13

Description

@gep13

Checklist

  • I have verified this is the correct repository for opening this issue.
  • 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 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

Tasks

  • Amend contributing documentation with a guide on how we write C# Cmdlets for PowerShell #3539
  • Format-FileSize.ps1
  • Get-CheckSumValid.ps1 - (#3477) Replace Get-ChecksumValid with Assert-ValidChecksum cmdlet. #3525
  • Get-ChocolateyConfigValue.ps1 - Rewrite Get-ChocolateyConfigValue cmdlet #3663
  • Get-ChocolateyPath.ps1 - Rewrite Get-ChocolateyPath cmdlet #3646
  • Get-ChocolateyUnzip.ps1
  • Get-ChocolateyWebFile.ps1
  • Get-EnvironmentVariable.ps1
  • 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
  • Install-ChocolateyPath.ps1
  • Install-ChocolateyPinnedTaskBarItem.ps1
  • Install-ChocolateyPowerShellCommand.ps1
  • Install-ChocolateyShortcut.ps1
  • Install-ChocolateyVsixPackage.ps1
  • Install-Vsix.ps1
  • Set-EnvironmentVariable.ps1
  • Set-PowerShellExitCode.ps1
  • Start-ChocolateyProcessAsAdmin.ps1
  • Test-ProcessAdminRights.ps1
  • Uninstall-BinFile.ps1
  • Uninstall-ChocolateyEnvironmentVariable.ps1
  • Uninstall-ChocolateyPackage.ps1
  • Uninstall-ChocolateyZipPackage.ps1
  • Update-SessionEnvironment.ps1
  • Write-FunctionaCallLogMessage.ps1
  • Before next release: ensure all associated docs PRs (Helper cmdlet documentation updates for CLI v3.0 docs#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

Sub-issues

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions