On Windows, the PATH environment variable is updated upon Script installation using PowerShellGet.
We need to ensure this happens consistently on all *nix platforms also
@raghushantha you don't normally edit a user (or the system's) path variable on *nix platforms, you either inform the user that they need to do it, or link the executables into a well-known binary location (e.g. /usr/bin).
What is the nature of PowerShellGet Scripts? (Self-contained exectuables, PowerShell scripts with a shebang, etc.)
Ref @bmanikm - owner of PowerShellGet
Here is the scenario:
PS C:\WINDOWS\system32> Find-Script Test-Credential | Install-Script
PATH Environment Variable Change
Your system has not been configured with a default script installation path yet, which means you can only run a script
by specifying the full path to the script file. This action places the script into the folder 'C:\Program
Files\WindowsPowerShell\Scripts', and adds that folder to your PATH environment variable. Do you want to add the script
installation path 'C:\Program Files\WindowsPowerShell\Scripts' to the PATH environment variable?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Untrusted repository
You are installing the scripts from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the scripts from
'https://www.powershellgallery.com/api/v2/'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PS C:\WINDOWS\system32>
Ah sweet. So as long as it's done interactively like this, it can happen. On *nix, if they say yes, you append a line to the end of their .bashrc with PATH="$PATH:<additional path>". The message will want to be updated so it explicitly asks something along the lines of "Do you want installation path '...' added to your PATH in your ~/.bashrc file?" Since the user could very well be using another shell (Zsh, PowerShell, etc.) and would need to update a different profile. This is very commonly done.
On that note, perhaps we should offer to add it to their PowerShell profile off the bat. We need to know our *nix customers' user of these scripts. Are they expecting self-contained executables runnable from within their Bash/Zsh shells, (in which case the scripts themselves will likely need to be modified; I suspect they're lacking chmod +x and #!/usr/bin/env powershell), or just scripts invokable from their PowerShell session?
Prompting work is not complete yet. Hence reactivating
@bmanikm Moving this to Alpha 10 - since the change is significant - support has to be added for multiple shells to update the PATH env variable.
The workaround for now is to invoke the script using full path or use the downloaded location
Why bother updating profiles for other shells? The scripts aren't going to work there anyway (at least, not yet, and probably not at ever, unless PowerShell is registered as a shell interpreter, and we convince the whole PowerShell community to put shebang lines in anything that works on Core...
Just (offer to) update PowerShell's profile, let them know about it, and move on?
This issue was moved to PowerShell/PowerShellGet#29