Asciinema 3.0 will be rewritten in Rust
github.com
github.com
https://asciinema.org/a/85R4jTtjKVRIYXTcKCNq0vzYH?autoplay=1
I still use and love asciinema, but will eventually check out vhs. It records terminal activity, outputs a gif, and you can publish to their[1] server.
Alternative you can feed it a "tape" file, aka a text file with a few configuration options and your ordered commands to run.
My workflow with asciinema sometimes has me cancelling out to redo w/ some minor change, so this tape concept is really attractive
I do like the concept but one charming feature of asciinema is it captures natural input hesitation, typing candence, deletions and fixing mistakes, etc. The VHS tape replay seems so artifical.
I could see how to fake it with the current commands, but I could imagine a "HumanType" or something which increases the delay variance or includes typos that are backspaced and fixed etc, automatically.
Just a quick ponder.
The fact you can iterate at all is its appeal to me
https://github.com/charmbracelet/vhs?tab=readme-ov-file#vhs-...
A custom command that could add some jitter automatically or just pretend to be a bit more human would be nice.
Lets type "ls -lap" with some hesitation and a typo...
Type "ls "
Sleep 200
Type "-"
Sleep 300
Type "l"
Sleep 50
Type "aa"
Sleep 100
Backspace
Sleep 150
Type "p"
Enter
:(There is the TypingSpeed variable but its not exactly what I'm going for.
I was looking at the code, and it seems like you could put a low value for this and it would do what you want.
I did not try it though
// sleepThreshold is the time at which if there has been no activity in the
// tape file we insert a Sleep command
const sleepThreshold = 500 * time.Millisecond
EDIT:I tested it. It actually work, but their software crash, I had to patch line 153
for lines[i] == lines[i+repeat] {
repeat++
if i+repeat == len(lines) {
break
}
}
EDIT 2:I actually went ahead and created a pull request to fix the bug.
I like being able to store my tapes in a repo and edit them:
https://github.com/zackproser/vhs-scratch
And as the official VHS docs show you can do even more interesting things with CI/CD
However, I quickly hit a painful limitation, viz.: if a command takes non-trivial amount of time to run, you need to hack it by using `Sleep` to wait for command output. So I'm not fully convinced to switch from asciinema.
Here is a ticket which mentions the Rust rewrite, perhaps this was what was intended: https://github.com/asciinema/asciinema/pull/579
cargo run
works a lot more reliably than messing with Python virtual environments and trying to figure out what system wide dynamically linked dependencies you need to install.Because pip install --user is the same principle.
'cargo install' does install to (usually) ~/.cargo/bin/.
The useful difference, though, isn't in where things get installed, it's that a Rust binary doesn't really care where it lives, and most don't have shared library dependencies that aren't commonly installed already. So things tend to just work, unlike with Python venvs.
It's almost like static linking is new technology
The second sentence was not clearly a second unrelated thought, but it was.
C++ has a few good options now: vcpkg, conan, and to a lesser extent CMake with github integration.
In a world with millions of developers, it just makes sense to allow an easier integration pathway.
https://github.com/asciinema/asciinema-player/blob/develop/p...
https://news.ycombinator.com/item?id=29387761
The Rust frontend frameworks have been creeping up the perf charts, though.
So far, apart from some minor bugs which mostly didn’t affect me, things have been working perfectly - so much so that it’s kind of surprising really. Kudos to Marcin (and my thanks for being so engaged on Mastodon when I had questions!)
Does using it as a library obviate vhs?
It's published up at https://github.com/rmccue/cinemastream if you're interested in trying it - it works, but still very early days, as it was just a holiday side-project. That said, likely to become a production tool for work, so will be cleaning it up a bit soon and squashing some bugs.
Worth noting that asciinema is not directly usable as a crate currently, so I did need to fork it to add a lib.rs, but the code was so well-structured that there's not much to do there: https://github.com/rmccue/asciinema/blob/rust-lib/src/lib.rs - Marcin did say he's open to it once 3.0 stabilised though.
Wow. I'm so curios about Rust now.
This is because of Spolsky's classic essay deriding rewrites, but that was in the context of a software company in a competitive market where the cost of a rewrite had to be weighed against the opportunity cost of letting your competitors erode your market share with shiny new features that you could have been matching otherwise.
Absent a competitive market (e.g. in volunteer OSS) rewrites are often quite successful, as long as they're undertaken by the original authors of the tool and as long as they avoid the second-system effect. (Note that nowhere does it say that rewrites must be in a new language.)
The only other type of given argument for moving to Rust was that the author enjoyed it, so it appears to be another "Rust is super cool" rewrite. It really speaks to the power of developer experience. People are willing to rewrite their entire application to be more comfortable. I know I am, only my language of choice is Common Lisp.
1: https://saidvandeklundert.net/learn/2021-11-18-calling-rust-...
2: https://www.infoworld.com/article/3664124/how-to-use-rust-wi...
You could grep like this:
asciinema convert demo.cast /dev/stdout -f txt | grep foo
I think it just boils down to the author feeling a lot more productive and less frustrated in Rust than Python. Which is a perfectly fine reason to switch!