fabiospampinato / vscode-terminals

An extension for setting-up multiple terminals at once, or just running some commands.
MIT License
121 stars 20 forks source link

how to stay in the same terminal ? #3

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi, still a beginner with VSCode and just trying to use vscode-terminals with vscode-commands. I don't understand if it's possible to have several different commands that could be executed in the same terminal. actually, I don't even know how to have the same command stay in the same terminal instead of creating a new one with the same name each time I launch it ?

sorry, maybe I misunderstood what I can do with vscode-terminals and maybe I should use another extensions in combination with vscode-commands. what I'm trying to do is having vscode-commands buttons that send different commands, but always in the same terminal. is it possible with vscode-terminals ? thanks for your work ! Fred

fabiospampinato commented 6 years ago

Hi Fred,

Thanks currently not possible, but it sounds like a nice feature, I'll try to implement it.

How should it work if there are multiple terminals already open? Which one should receive the new command?

fabiospampinato commented 6 years ago

If it's not important to keep the output of the previous commands, and you just don't want to create many terminals, simply execute a logout command at the end, so that it will get automatically closed.

ghost commented 6 years ago

for what I'm looking for, I need to keep the same terminal, to keep the context. but after a little try whit "terminals", I understand that it's not really easy. actually it's not clear to me why the same command, which call the same terminal name don't do again the same thing in the same terminal. instead of that it creates a new terminal with the same name !? why naming the terminal if the name is not really use to identify the terminal. that should be the name of the command actually.. now, to be able to do something like I want, there should be a name for the terminal and a name for the function/command. so I could set several functions and point them to the same terminal. if a terminal with that name doesn't exist, it's created and if one exist, the function is called into it.

I understand that it could be a lot of change in "terminals", so don't worry if you prefer not break the actual way it works. thanks..

fabiospampinato commented 6 years ago

Thanks for your feedback.

The extension works the way it does because it was originally meant to replace a bunch of applescripts I was using at that time for spawning some terminals at startup and nothing more. Everything else came later.

Naming the terminals is useful for the dropdown menu used for switching between them, instead of having bash, bash, bash, or something, you get actual names.

I'll implement something that will suit your use case as soon as I get some free time.

ghost commented 6 years ago

ok, what you say about multiple "bash" terminals, is still here actually. if I call several time the same command, I will have several "nice-name", "nice-name",... thanks a lot..

fabiospampinato commented 6 years ago

Yes your point is right. As I said it wasn't originally designed with this use case in mind.

ghost commented 6 years ago

don't worry, I understand.. :-)

fabiospampinato commented 6 years ago

No need to close this, I'm going to fix it.

ghost commented 6 years ago

ok, sorry.. understand you are about to fix it, was just not to forget later to close it.

fabiospampinato commented 6 years ago

Fixed in v1.6.0.

There's now a recycle option, which is true by default. Basically multiple terminals executions that have the same name will share the same instance.

There's also a target option, which can be used to basically run commands in another terminal's instance.

Hope you like it, and thanks for the suggestions!

ghost commented 6 years ago

wow, sound's great, thanks ! will try it this evening after work. thanks a lot for your rapid work !

ghost commented 6 years ago

just working great, thanks !! 👍