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
Commands like get-childitem could emit hyperlinked clickable directory entries using OSC sequences when hosted by windows terminal #18098
Comments
Does it allow executing arbitrary commands? That is, what will happen if you click on the link to a file or folder? Will it be always be run by default application, same as with |
I haven't tested much. The behavior is as if you click a file or a folder with the mouse in Explorer. |
Too bad, that pretty much kills all utility to me, as it also won't do anything useful over SSH. |
On Linux works too, it opens files and folders in default applications according mime-types except executables or desktop-files: Get-Childitem /some/dir | Foreach-Object {
Write-Host " `e[4;34m`e]8;;file://$($_.FullName)`e`\$($_.Name)`e]8;;`e`\`e[0m"
} PS. This is correct for Windows too. |
@237dmitry exactly like that! @dkaszews it would only execute things with something like start-process, I think the parent process will be the terminal and not powershell though. I would like for it to be able to execute commands as well but that's beyond the capabilities of this OSC sequence. |
@ironyman there are at least 2 reasons why this can't be the default. However you can customize this to suit yourself and load the customization from your profile. To do this
with
I'm making the links cyan (96) for good contrast and using
I'm happy to post my version as a gist. |
@jhoneill That's pretty amazing, thanks. Maybe it would be possible to somehow ship this as a PowerShell module so that it could be installed via PSGet? |
@RReverser Thanks over the years I have posted multiple replacement formatting files - not just for files. It certainly is possible to have a module which only loads formatting, but everyone seems to want something different. Some key people on the team like to splash colour around, I find that makes things harder to read - and helpfully I can manage that via PsStyle. Some people want links, some want different date format or thousand separators in numbers, or narrow columns or 101 other things, so there isn't one solution to please everyone - hence I keep helping people to customize it. Note that the |
For me being able to install it via PSGet or another package manager is mostly about reproducible installs - if I reinstall Windows on a new machine at some point, I'd love to be able to easily get familiar environment via winget+PSGet+custom config files. The scenarios like described above are easier to lose / forget how I got that formatting in the first place, hence wondering if it can be automated. It looks like a fairly straightforward copy + find-replace (or XML manipulation) + import, so it seems it could be put into a module in a way that would still allow it to compose well with most other formattings you mentioned? (except those that add colors I guess) |
Summary of the new feature / enhancement
Hi all,
There was some discussion about this in the terminal project.
microsoft/terminal#5001 (comment)
Using this feature supported by windows terminal
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
To summarize, when a user runs dir, it would be super awesome to able to shellexecute the listings from dir by clicking on them, which we could do using the OSC sequence from the that gist.
Thoughts?
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: