Hacker News new | past | comments | ask | show | jobs | submit login

I don't know... wouldn't it make more sense to parse a script(1)-log with javascript? There's some code to do that already:

  https://github.com/josch/scriptreplayjs
  https://blog.mister-muffin.de/2011/07/05/scriptreplay-in-javascript/
And another project that uses a similar approach (but as far as I can tell, doesn't use plain script files):

  https://asciinema.org/
One benefit with scriptreplayjs is that you could just download the script-file and play it pack with script/scriptreplay (the former under BSD (and Linux?), the latter (only) under Linux, if I read the man-pages right).

And the fact that the script is (mostly) text -- so it should be easy to make it copy-pasteable...

I suppose it should be possible to patch either project to overlay key presses...

https://www.freebsd.org/cgi/man.cgi?query=script(1)&sektion= http://man7.org/linux/man-pages/man1/scriptreplay.1.html

https://packages.debian.org/wheezy/bsdutils

[edit: Might be cool to hack this tool to work with regular script logs -- so it could generate gifs, or other tools could be used for js "playback"? ]




Unfortunately, script is probably not usable here:

From the github page:

  specifically, I wrote this with the forthcoming Vim Stack Exchange site in mind
From the script docu:

  Certain  interactive  commands,  such  as  vi(1), create garbage in the typescript file.
  script works best with commands that do not manipulate the screen, the results are meant
  to emulate a hardcopy terminal.


Ah, I missed that. Apparently the answer to script's limitations, is ttyrec:

http://0xcc.net/ttyrec/index.html.en

There appear to be many players, eg:

https://github.com/oliy/ttyplay

See also:

https://github.com/jedi4ever/ttyrec.js

Apparently vim-sessions should work:

https://github.com/jedi4ever/ttyrec.js/issues/1

There's a site devoted to tutorials based off of ttyrec:

http://playterm.org/

Or, for just vim, Replay.vim: http://www.vim.org/scripts/script.php?script_id=3216

Other than that, I'm inclined to have a look at op's code to see if one might break out the gif-encoding to a sepearate bit -- and "encode" for js/html playback (as well, or in place of) video/gif.


Years ago I rewrote rxvt in javascript. https://github.com/paddymul/rxvt-js my aim was to create a terminalcast recording site. my rxvt implementation doesn't work with color, but it can succesfully redisplay an emacs session with split windows.

Please, hack on the code, this is something that should exist.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: