anki-code / xontrib-sh

Paste and run commands from bash, zsh, fish, tcsh in xonsh shell.
MIT License
54 stars 5 forks source link

PowerShell hasn't syntax checking option #3

Closed eugenesvk closed 3 years ago

eugenesvk commented 3 years ago

On Windows when including PowerShell 7 ($XONTRIB_SH_SHELLS = ['pwsh']) trying a ! echo 1 fails with

pwsh:
Invalid argument '-nc', did you mean:
  -encodedcommand

I guess this is due to the fact that there is no -n flag in PowerShell, and I don't know what the alternative for noexec syntax check is https://github.com/anki-code/xontrib-sh/blob/9c0d2deb9a9b7e5f76082d677cc9a400f11d7253/xontrib/sh.py#L22

anki-code commented 3 years ago

Hi! Thank you for reporting this! To partially avoid this we can disable syntax checking when we have one shell in the list and just run the code. Also we can add info about this workaround to the "Known issues" section. PR is welcome!