posh-git icon indicating copy to clipboard operation
posh-git copied to clipboard

Allow overriding $PROFILE file in Chocolatey installer

Open tylerszabo opened this issue 5 years ago • 3 comments

System Details

  • posh-git version/path: 0.7.3.1 C:\tools\poshgit\dahlbyk-posh-git-9bda399\src
  • PowerShell version: 5.1.17134.112
  • git version 2.18.0.windows.1
  • OS: Microsoft Windows NT 10.0.17134.0

Issue Description

I notice in chocolateyInstall.ps1 for the posh-git Chocolatey package. That the install script uses the following:

    if ($PROFILE -and (Test-Path $PROFILE)) {
        Write-Verbose "Updating posh-git location in `'$PROFILE`'."
        $oldProfile = @(Get-Content $PROFILE)

It'd be really handy to be able to use Chocolatey package parameters or an Environment variable.

tylerszabo avatar Jul 09 '18 08:07 tylerszabo

Would you like to specify an exact path, or one of the named $PROFILE locations (CurrentUserAllHosts, etc)?

dahlbyk avatar Jul 09 '18 13:07 dahlbyk

In my case the exact path would be more useful since I split my profile up a bit so I'd point posh-git to $env:USERPROFILE\Documents\WindowsPowerShell\Profile_PoshGit.ps1.

tylerszabo avatar Jul 09 '18 21:07 tylerszabo

Interesting. Supporting an environment variable to override the posh-git install location seems the easiest option to let the setting propagate all the way down into Add-PoshGitToPrompt.

dahlbyk avatar Jul 09 '18 23:07 dahlbyk