-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Documentation: terminal uses ;
for separating subcommands
#4570
Comments
If you're launching from powershell, it's interpreting |
I want to re-open this, since we should update the documentation here to mention the powershell quirks |
Why is |
@DHowett-MSFT yep, the issue lies within PowerShell, in cmd it works fine. |
Valid docs issue for 1.0; yanking the triage tag. @maknapp this is what tmux does. We're in an interesting place, being an application that spawns other applications (often from other applications) -- we need to choose a character that isn't going to be too likely to be used with the receiving application (the final shell spawned at the end) but doesn't provide a terrible experience for the spawning application. We think tmux did a pretty good job of that overall. |
Additionally, we discussed this in the spec when this feature was being proposed and reviewed. |
Can someone explain why I don't want to hijack this issue but was wondering if it's just another documentation issue. Should I open a separate issue? |
I sure can! That's because of PowerShell/PowerShell#9970. |
This is not a documentation issue. Windows Terminal is a Windows app. The most popular shell on Windows is PowerShell. And, we need to use escaping character to make wt.exe's command-line parameters work in PowerShell? |
Let's be honest: I never saw the spec until now, but this is hard to use (from PowerShell), and nearly impossible to script (since there's no console output) and you obviously knew that going in. I don't understand the whole "this is what xterm did" argument, but it doesn't hold water. Did you write a man page? This is not unix, and it's not bash, and xterm isn't a "window mode" app that pops up dialogs for help, either. The semicolon is a command separator in a lot of shells, and particularly in the primary modern shell on the only operating system where this application runs.... I think you picked the wrong separator. 'nuff said on that. I also think the output going to a dialog is the wrong choice. Features like Frankly, I have not even tried to use I'm sorry I (or "we") didn't get involved in the design spec stage ...For what it's worth to the docs: the only syntax that works at this point without complications in PowerShell to use start-process and quote all the parameter blocks. Even then, you must be careful to use double quotes around profile names (not single quotes, because it can't handle it), and you can't use the normal double-double method of escaping so you have to write one of these two syntaxes: Single quoted parameters (if you aren't calculating anything):start wt '; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe' Escaped quotes (if you need variables):$ThirdPane = "wsl.exe"
start wt "; split-pane -p `"Windows PowerShell`" ; split-pane -H $ThirdPane" Because if you just escape the ; your current instance is stuckwt new-tab "cmd" `; split-pane -p "pwsh" `; split-pane -H wsl.exe |
I would suggest using |
@Jaykul so, there's a couple issues here
|
(We can probably do some math on our standard output handle, if we have one, to see whether it would be amenable to receiving output. This would at least allow |
Couldn't you embed the "real" windows terminal program as a resource inside a console mode exe that only calls the embedded resource when it's not called with |
@jantari that's got all the same problems as just shipping If the wrapper is a console mode exe, |
@DHowett-MSFT ok, you know what ... I can live with But it's just not the same. At all. From WSL pwsh, this works as expected. It makes a new session and connects it in the terminal I was already in: tmux new-session bash `; split-window pwsh -noprofile `; split-window -h cmd.exe But the equivalent wt new-tab wsl `; split-pane -H pwsh -noprofile `; split-pane cmd
Anyway. I've updated the post I wrote above with the On top of that, I can't use this syntax in a terminal "profile" for the same reason ... |
Why doesn't e.g. Am I missing something? |
Yes, @riverar, you are missing something. It is meant to take a script. Right now, it's parser and implementation are buggy, but look at a simple example. Run these two and notice that the order matters? I've used PowerShell syntax: wt new-tab -p PowerShell` Core`; split-pane -H -p Windows` PowerShell `; split-pane -p cmd wt new-tab -p PowerShell` Core`; split-pane -p cmd`; split-pane -H -p Windows` PowerShell This is like Now, the parser they're using is not good enough. It can't handle writing these the way tmux users do, with new-line wrapping. It also can't handle when PowerShell starts adding quotes -- so in PowerShell, I'm forced to backtick escape spaces in profile names, rather than quoting them. But this doesn't work anyway, because it reads the newline as part of the command name: wt `
new-tab -p PowerShell` Core`; `
split-pane -H -p Windows` PowerShell `;`
split-pane -p cmd |
@Jaykul I don't see anything in your script that can't be expressed via parameters? What am I missing? |
I marked #4601 as the discussion parent for this issue, so I'm going to continue treating this one as "we should better-document the use of |
;
for separating subcommands
This PR adds some notes from #4570 to the [UsingCommandlineArguments.md](https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingCommandlineArguments.md) doc. Hopefully, this should add clarity on how to use sub-commands in the `wt` commandline from within Powershell. * [x] Closes #4570 * [x] I work here * [x] This is docs
@Jaykul So, I wanted to circle back with the benefit of some time having passed.
In the past year we added Does that track? 😄 |
Ah, and:
Implemented the command palette with a commandline mode to fix (4) 😁 |
Or maybe we could have made Windows terminal compatible with a classic list of arguments and the two most common arguments separators that all OS and program use, the space or the comma. To be able to indicate a command like: Replacing
By
A variant with an equal symbol and a space in the sub-argument names:
A complex one works well:
This makes it usable from PowerShell, Cmd, Bash and all others without escaping the characters, and allows not to confuse a Shell command list with parameters of a program, as well as to allow the launching of Windows Terminal with multiple command and classic ";" command separator
|
Let me preface by saying: I'm mostly happy with how things are going.
I'm not sure how people are meant find out about the |
We sort of definitely did, it's just not the most discoverable feature we've ever authored[1] 😄 It even tells you what it's about to do! With named profiles and all! It very much answers at least half of your bullet points.
I like this. 1: it all starts with you having to delete the |
OMG, you did! That's awesome! 😯🤨😑😣😞 Too bad you buried it without so much as a grave marker 🪦🪦🪦 I think this team has some misunderstandings about how command palettes work everywhere else, which I can't understand. First of all, these are not a new idea in VS Code (or Sublime). Please have a look at some of the "launchers" that introduced the concept so many years ago, like Alfred, Albert, Launchy, Krunner, Quicksilver, (and ... Flow and PowerToys' Run). The
|
You know, there was some reason why we couldn't make it a literal character in the input, and instead faked it, and I can't remember the exact reason why now. Also, we probably should support Home, Bksp to switch into commandline mode, and typing a It will try to parse what you type: and there's #7570 for "intellisense" in that box. |
When executing the following commands, they don't work
wt ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe
or
wt new-tab -p "Windows PowerShell" ; split-pane -p "cmd"
It opens only the first profile, but not the second one, and throws an error in the main window.
The text was updated successfully, but these errors were encountered: