Add Markers with Title from CLI

Hey there!

Is it possible to label the markers from CLI?
I only found the hotkey “add_marker_key = C-x”, which adds markers, but I want to add them programmatically.

My use case is for each new prompt line I want to set a marker with the last command.
I thought of something like asciinema marker "Executed: ${VARIABLE}"

I tried several things and the only way it works is by pausing the recording via hotkey, echoing the marker and continuing the recording.

Seems the file is locked by the recorder as I can see my echo’s when I tail the target file but cat’s on the target file only show the markers added by asciinema itself (via hotkey).

@ku1ik Maybe you got a nice idea to achieve this?

That’s the command I try currently (tee for immediate flushing):

echo "[${command_log_time}, \"m\", \"${3}\"]" | tee -a $logfile > /dev/null

or redirection

echo "[${command_log_time}, \"m\", \"${3}\"]" >> $logfile

both don’t work. :frowning:

Yeah, right now there isn’t an easy way to achieve that. But I plan to implement an RPC mechanism for 3.0 (less likely) or 3.1 (more likely) release, which will enable many new use cases through the programmatic control. I don’t have a fully fleshed out plan for it yet, but hopefully we’ll be able to have something like asciinema rpc add-marker "my label".

1 Like

I got it working with some python parsing magic :smiley:

For each command executed, I just output the command to a .cast.commands.log as sidecar file with just the “m” notations.

https ://github.com/cmprmsd/cinelog/raw/main/docs/file-structure.png

When I then search in my logs, the output of both files will be parsed and merged to a single timeline file.

https ://github.com/cmprmsd/cinelog/raw/main/docs/command-search.png

Which will result in the player with my command markers. :heart:
demo-webplayer

I published this terminal logging project and want to thank you again for your quick support in the past on Github and this project! :love_you_gesture:

PS: Feel free to fix the image-links. I’m to new on discourse to post more than two links sadly although we discussed some issues on GitHub in the past. (technical limitations :laughing:)