Windows PowerShell Support
Hello,
Great tool, use it on my MacOS and Linux environment, now I am trying to use it with PowerShell/Windows. I can create new commands entries, however when it comes to pet exec the default shell is dos(cmd.exe) and not PowerShell. Still good enough to save the the crazy PowerShell commands I have to remember, however it would be nice to have it execute the command as well.
Thanks in advance. If you can guide me through where to make the changes/updates, I can make changes, test, and make a PR if anyone could else would be interested.
-- Enrique
Hey Enrique! I can look into this for you and guide you through it :)
Right now we have a file called util_windows.go (and util_unix.go), these define the run function which is used to actually execute the command in question. We'd want to somehow create an alternative run that uses powershell I'm guessing.
We'd either have to:
- Change the
runsignature to also accept the 'shell type' from somewhere. Maybe we can get this from the shell itself (some way to detect if we're running in powershell) or somewhere else idk. - Create a global config flag that decides which shell to use. That means you're limited to using either powershell or cmd until you change your global pet config.
I think the global config option is way easier to implement and less disruptive. I'd go for that as a first step if I were you!
And we might have to update the 'selection' as well potentially, not sure about that one.
Thanks for your response on this @RamiAwar ... I've moved away from PowerShell at the moment, but I am sure this would still be a nice feature for some other people who are working with PowerShell.
I can close this ticket if I need to, or I can leave it open to be referenced in a PR.
I see, yeah no worries! Yeah let's keep it open, I think it's easy to implement and I'll probably get to it later!