Start it and copy some things, then press Ctrl+c and you get a list of all things you copied.
~/.bin/sequential-paste-recording
#!/usr/bin/env bash
list=()
last=""
echo "Starting sequential paste recording of clipboard copying"
echo "Press Ctrl+c when done, and all copied things will be returned"
on_exit() {
echo "${#list[@]} clipboard copy calls recorded"
echo
for item in "${list[@]}"; do
echo "$item"
done
}
trap on_exit EXIT
pbcopy < /dev/null
while true; do
now="$(pbpaste)"
if [[ "$last" != "$now" ]]; then
list+=("$now")
last="$now"
echo "Adding $now"
fi
sleep 0.1
done
chmod u+x ~/.bin/sequential-paste-recording
$ sequential-paste-recording
Starting sequential paste recording of clipboard copying
Press Ctrl+c when done, and all copied things will be returned
Adding foo
Adding bar
Adding baz
^C
3 clipboard copy calls recorded
foo
bar
baz
To try it I did
echo foo | pbcopy
echo bar | pbcopy
echo baz | pbcopy
This is an initial version. Could make it automatically put everythinig in clipboard while copying. But should probably try this simple variant first.