charmbracelet / vhs

Your CLI home video recorder 📼
MIT License
14.35k stars 240 forks source link

Support multi-line commands #68

Closed jacobtomlinson closed 1 year ago

jacobtomlinson commented 1 year ago

I'd love to see support long commands and choose where the line breaks happen.

$ mamba install -y python=3.11 \
    foo bar baz 

It seems VHS doesn't support this, I tried the following.

# This includes the `\\ \n` characters in the command

Type "mamba install -y python=3.11 \\ \n foo bar baz"
# This gives a 'Error: parse error'

Type "mamba install -y python=3.11 \
foo bar baz"
michaeltlombardi commented 1 year ago

Being able to use here-strings or equivalent would be great, I use multiline commands often for readability in my examples.

maaslalani commented 1 year ago

You can do this with:

Type "mamba install -y python=3.11 \"
Enter
Type "foo bar baz"
maaslalani commented 1 year ago

out

maaslalani commented 1 year ago

Feel free to reopen this issue if that's not the correct solution to what you're asking about.

jacobtomlinson commented 1 year ago

Oh yeah, I didn't think of that. Thanks! Thinking about things in terms of key presses instead of characters is a bit of a mindset change.

I wonder if it would be valuable to users to make Type "\n" equivalent to Enter?

jamesowers-cohere commented 1 month ago

With apologies this is off topic for this issue...

@jacobtomlinson I'm struggling to get mamba/conda to play nice in my .tape because the shell is launched with --noprofile --norc

https://github.com/charmbracelet/vhs/blob/bea7f77ab4cf5e6439aa33709bb5c6e25a4b707c/shell.go#L24

How did you get it to work nicely?

jacobtomlinson commented 1 month ago

@jamesowers-cohere it's been a couple of years since I tried this, so things may have broken since then.