-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wt.exe] Add support for appending a commandline to a profile's commandline #5528
Comments
Uh, that's literally how it's supposed to work now... This doc has some examples. Are you seeing some sort of error when you try that? Are you running the commandline from |
@zadjii-msft The examples you gave are for different terminal programs to be assigned to the different views. My example with
My default terminal profile is using |
oh oh oh I think I see what's happening. You can also see this in the So, for the EDIT: Okay I'm seeing now the update to your post to include notes about "git bash". I'm not super familiar with how git bash works unfortunately, but I'd presume that you'd need to use the following commandline: wt "C:/Program Files/Git/bin/bash.exe" yarn some-command Here, I'm assuming that |
I've tested it. It works, but every time I have to enter the full path of the command line terminal, before passing commands to it. It would be great the fire up the default if none are present. :) |
So that gets complicated.
There's maybe room for us to add something like |
Just an idea: Your idea with |
I'd personally like to see support for adding command line arguments for the profile after launch. This way once a tab is launched we can have it so that it automatically executes a command in that terminal window. |
@Ruegen |
This seams to work for running command in a new open window.
This will run Ubuntu WSL and then execute |
I believe the reason for this might be that "C:/Program Files/Git/bin/bash.exe" is used, but the user to use it has not been "logged in". What I mean by that is, take this for example. This is my GitBash profile: {
"guid": "{00000000-0000-0000-0000-000000000001}",
"acrylicOpacity": 0.9,
"useAcrylic": true,
"closeOnExit": true,
"colorScheme": "Solarized Dark",
"commandline": "\"%PROGRAMFILES%\\Git\\usr\\bin\\bash.exe\" --login -i -l",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Consolas",
"fontSize": 10,
"historySize": 9001,
"icon": "%PROGRAMFILES%\\Git\\mingw64\\share\\git\\git-for-windows.ico",
"name": "GitBash",
"padding": "15, 5, 10, 55",
"snapOnInput": true,
"startingDirectory": "%USERPROFILE%\\Desktop"
}, Notice how it has Although, probably I'm totally off the ball on this one. |
It would be incredibly useful to open a Windows Terminal (wsl) profile from the commandline and run a command inside afterwards. Something like
I could create shortcuts to projects and stuff, start environments with a single click. I tried many different combinations of the Thanks for the help! |
@DennisBecker Can you not use |
@tihomir-kit I was attempting the exact same thing. I'll elaborate on a fix since I landed here searching for a solution, too. Basically the goal was:
The problem with this was that I was incorrectly assuming that the The key is just repeating the path to wt -p GitBash -- "%PROGRAMFILES%\Git\usr\bin\bash.exe" -i -l -c "COMMAND" Breaking it down:
|
Following what @patricknelson wrote, if you have eg. And you don't even need a custom profile. |
@patricknelson Thanks a lot, that did the trick! @akaltar For some reason that doesn't work for me. I checked the What I get is:
|
Hmm, now I ran into a different issue, is there a way to end the double dash? With that, I can run something, but I would like to chain a |
Well this worked finally: set bsh="%PROGRAMFILES%\Git\usr\bin\bash.exe"
wt ^
-p GitBash -- "%bsh%" -i -l -c "alias1"; ^
split-pane -V -- "%bsh%" -i -l -c "alias2" I did it with a batch script instead of bash because bash complains about insufficient permissions when I try to run WT from it.. The last thing that would be nice to have is to be able to actually stop the command that was running and keep the pane. For example if an |
You can set |
@tihomir-kit Also when adding the git bash path to your PATH, make sure it comes before any other bash executables. I had to move it up in the list quite a bit. |
(removed comment, sorry I didn't read the question properly) |
I'm gonna make probably a 🌶️ take, but yank "spec needed" off this. A spec seems too heavy. I think we should just do this as
so
would do what you'd expect. We can come up with a short form in the review, if we really need. Should be trivial to add to It's up to the user to make sure that their combination of chosen profile &
|
@zadjii-msft I like your suggestion. It perfectly fits with my original intent. |
When evaluating the full commandline in AppCommandlineArgs::_getNewTerminalArgs, should we fetch the chosen profile |
Oh, you bring up a very good point. Nowhere in Maybe it makes more sense then to add a boolean to NewTerminalArgs, that'll change how In that case:
|
Added --appendCommandLine flag that when set, appends the command to the preset command in the profile instead of replacing it. Previously, there was no good way to launch wt while running a command appended to the set command in the profile. Some uses include profiles that are set to login or start an application. Additional comments: Looking for a review, and expecting additional changes that needs to be done. For example, I am not really sure on how to include the the option's information in the CallForHelp() screen. Also, would be great if someone could guide me on including tests for this new feature. Thanks! Closes #5528 --------- Co-authored-by: Charles Liu <hliu729@outlook.com>
Add --appendCommandLine flag for appending to command |
Description of the new feature/enhancement
After the #5090 update it would be great if we could do something like this:
It would enable us to execute commands in the Windows Terminal sessions and it can be used as any normal console terminal right now.
The text was updated successfully, but these errors were encountered: