Cross-platform fixes + new features
Hey guys, I have a lot of things for you. To begin with, the tool has big problems with cross-platform and not only, so I suggest you look at my solutions to these problems.
Entry Points Introduction
Allows to select the environment in which subsequent commands will work. Something like a replacement for 6466fa95686a2e3c245bfbe8245741221660ba63 but with more features.
"Lazy Shells" Introduction
From the point of view of the language, these are just functions that return Shell structure.
This thing allows you to handle additional conditions, which for example helps to solve compatibility problems or detect if the user does not have a specific shell.
Example: https://github.com/charmbracelet/vhs/blob/3797c980d7c84875fd34193b5c44865c3d9d022f/shell_windows.go#L16-L29
Here we determine which version of PowerShell is available and, depending on this, we call the necessary parameters.
Other things
Remove useless work (due to feat: Set Shell and features above)
See f525522172e0d9590943f0247ba4bcd2553b6a26. Previously, it was necessary to solve the problem of working on Windows, as well as fix the output. And now with the new features, it's just useless.
Splitting the shell list into "Windows compatible" and "Unix compatible".
See shell_windows.go and shell_unix.go
Fix incorrect powershell output (72d81d6b52a375d45dda97c26625f7b8335bd220)
Tape:
# Where should we write the GIF?
Output demo.gif
Set Shell pwsh
# Set up a 1200x600 terminal with 46px font.
Set FontSize 46
Set Width 1200
Set Height 600
# Type a command in the terminal.
Type "echo 'Welcome to VHS!'"
# Pause for dramatic effect...
Sleep 500ms
# Run the command by pressing enter.
Enter
# Admire the output for a bit.
Sleep 5s
Before:

After:

Fix #39 (e8d5abf3beb889782ad3d66e810b9f0a75b7f3a8)
This problem arises due to the fact that we start recording before our "prepare" commands are executed. The next solution is more of a crutch, which in some cases may not help, but still better than nothing.
https://github.com/charmbracelet/vhs/blob/e8d5abf3beb889782ad3d66e810b9f0a75b7f3a8/vhs.go#L165-L167
First frame before:

First frame after:

Remove unlogical pwsh != powershell from b0c663c9bc8065d73412a442d8672f4fe59cffa0
Due to "Lazy Shells" now it's possible.
Before:
# What to use?
Set Shell pwsh
# or
Set Shell powershell
# What a difference? Idk...
# HELP!
After:
# 😎
Set Shell pwsh
~Another crutch~ Correction of possible errors related to the fact that logging into the shell may be too long
https://github.com/charmbracelet/vhs/blob/3797c980d7c84875fd34193b5c44865c3d9d022f/vhs.go#L132-L142
At first it was one of the implementations of new features, but then I realized that it solves more things.
In the end, I want to say that I'm new to golang, so there may not be completely rational things here, so if anything, leave your reviews so that I can improve and learn new things)
Thank you! Have a nice day!
I feel like we're mixing together a couple of changes in a single PR here. Might be easier to review if we stick to one issue per PR.
pwsh is used by newer cross-platform PowerShell 6+ (Core) which needs separate installation whereas powershell is used for legacy one which comes installed by default in Windows ~10 and above~ even older. They can coexist hence the difference in names.
I feel like we're mixing together a couple of changes in a single PR here. Might be easier to review if we stick to one issue per PR.
I agree, but I think it's already too late...
is used by newer cross-platform PowerShell 6+ (Core) which needs separate installation whereas
powershellis used for legacy one which comes installed by default in Windows ~10 and above~ even older. They can coexist hence the difference in names.
Thank you, but I didn't ask, I was just simulating an ordinary developer who doesn't know the details. That's why it's a PR section, not an issue.
I think most of this have been fixed on main, and there's a couple more improvements in #218...
I like the idea of the magic text, although I believe #218 will make it unnecessary...
Like Carlos mentioned, most of the fixes are currently on main, with the addition of starting shells with ttyd, I believe this PR can be closed. Let me know if there are any missing features that we still need to add here.