You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 11, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 11, 2024. It is now read-only.
Another thought re installation: you could simply turn your *.ps1 file into a script that can be invoked directly rather than embedding a function definition in it. Now that Install-Script offers to put the folder for installed scripts in $env:PATH, that is sufficient.
@mklement0, I am investigating this and I am afraid that I will lose the possibility to set an alias for the script (Set-Alias ctex ConvertTo-Expression). The only option is to move to a module but I want to keep the whole setup simple.
Actually, I think that it should be possible set an alias through the Meta data set by new-scriptfileinfo/new-scriptfileinfo which should than be implemented by the Install-Script cmdlet. Agree?
It would indeed be nice if you could specify them via New-ScriptFileInfo and if PowerShell would automatically define them.
I suppose the alias information could be included in the <scrpt-dir>/InstalledScriptInfo/*.xml files created by Install-Script and read by the engine on startup - without too much of a performance impact (analogous to how module manifests are scanned).
On the other hand you could make the argument that predefining aliases for the user should be limited to modules.
I encourage you to open a feature request and see what others think.
Btw, another problem with using *.ps1 files directly as commands is that on case-sensitive file-systems - notably on Linux by default - you'll only be able to invoke the script if you match the file name's case exactly - which is both inconvenient and unexpected.
Activity
iRon7 commentedon Oct 22, 2020
@mklement0, I am investigating this and I am afraid that I will lose the possibility to set an alias for the script (
Set-Alias ctex ConvertTo-Expression). The only option is to move to a module but I want to keep the whole setup simple.Actually, I think that it should be possible set an alias through the Meta data set by
new-scriptfileinfo/new-scriptfileinfowhich should than be implemented by theInstall-Scriptcmdlet. Agree?mklement0 commentedon Oct 22, 2020
Yes, aliases are a problem.
It would indeed be nice if you could specify them via
New-ScriptFileInfoand if PowerShell would automatically define them.I suppose the alias information could be included in the
<scrpt-dir>/InstalledScriptInfo/*.xmlfiles created byInstall-Scriptand read by the engine on startup - without too much of a performance impact (analogous to how module manifests are scanned).On the other hand you could make the argument that predefining aliases for the user should be limited to modules.
I encourage you to open a feature request and see what others think.
mklement0 commentedon Oct 25, 2020
Btw, another problem with using
*.ps1files directly as commands is that on case-sensitive file-systems - notably on Linux by default - you'll only be able to invoke the script if you match the file name's case exactly - which is both inconvenient and unexpected.iRon7 commentedon Apr 10, 2024
Covered by the ObjectGraphTools module