lalilaloe / wttab

Programmatically open Windows Terminal tab or window
MIT License
4 stars 2 forks source link

Unable to run more than one word commands properly #2

Closed MiguelGoncalves98 closed 3 years ago

MiguelGoncalves98 commented 3 years ago

First of all, I am sorry if this is me being unable to grasp something basic about the functionality of "wttab".

Essentially, I had a script in my "package.json file" to do the following bit of code.

image

The first script ("tab:launch:bot1") that used only the "ls" command worked fine, however, the second ("tab:launch:bot2") that ran a command separated by spaces was getting messed up, as the Powershell was separating them commas. I tried to escape the spaces, to put the command between (') and none of it seemed to work. Once again, I am sorry if this is me being unable to grasp anything obvious.

I ended up adding a little bit of a hacky solution (seen below, highlighted), that essentially checks if the command has content separated by spaces and interprets it as a single, joint command. image

I'm sure this is not the way to do it, and it may even cause problems for other cases, I just found a way to fix it for what I wanted.

Anyways, I would like to know if this had a simpler and more elegant solution, if it was something I missed, or if there was another way to workaround it.

Thanks in advance!

lalilaloe commented 3 years ago

This is a known bug, in the mean time you can use quotes to get arround this ex. wttab -t Bot2 'npm run launch:bot2'. It would be nice to add support for quotless commands while passing other parameters.

MiguelGoncalves98 commented 3 years ago

I tried doing so, and intended to say I did it, but maybe the message was poorly phrased. When I tried to put the quotes, the Powershell interpreted it as 3 seperate commands, essentially it ran 'npm' first, then 'run', and then 'launch:bot2'! That, of course, yielded some errors :(

lalilaloe commented 3 years ago

What terminal do you try to launch?

MiguelGoncalves98 commented 3 years ago

I ran it on windows terminal, which was using Powershell.

lalilaloe commented 3 years ago

This is now fixed in v1.1.0 see 77eccaecb9b962aa1171804667a46e96cbcd2f83. Thanks for letting me know 😃

Powershell executed it as an array instead of a string