run shell command

This commit is contained in:
Q
2022-11-14 17:50:42 +02:00
parent dd7e6f4d1d
commit 4f2abdf86c

View File

@@ -9,9 +9,9 @@ _help() {
default framerate: '$framerate'
default delay: '$delay'
-i for interactive selection using "slop"
--shell to record current terminal
--shell "[cmd]" to record current terminal, default cmd: bash
Hit "q" when finished!
Hit "q" when finished (or exit shell in --shell)!
'
}
_helpexit(){
@@ -26,6 +26,7 @@ framerate=15
delay=0
interact=0
new_shell=0
shell_command=bash
for (( i=1; i<=$#; i++ )); do
[[ ${!i} = "-h"* ]] && _helpexit
[[ ${!i} = "--h"* ]] && _helpexit
@@ -58,10 +59,11 @@ for (( i=1; i<=$#; i++ )); do
fi
if [[ ${!i} = "--shell" ]]; then
new_shell=1
shell_command="${!j}"
shift
fi
done
shell_command="${shell_command:-bash}"
if [[ $delay -gt 0 ]]; then
echo Waiting.. for $delay seconds
@@ -95,9 +97,6 @@ if [[ $new_shell -eq 1 ]]; then
echo Starting to record in 5 seconds, or press enter
read -t 5 foo || true
x0=$( tput cols )
pre=$( qolop eval "_qPos save; _qPos abs 1 $x0; _qCol R;" )
post=$( qolop eval "_qCol Z; _qPos restore;" )
ffmpeg \
-video_size $size \
-framerate $framerate \
@@ -112,13 +111,11 @@ if [[ $new_shell -eq 1 ]]; then
"$filename" &
ffpid=$!
clear
bash
eval "$shell_command"
kill -INT $ffpid
trap - EXIT SIGINT SIGTERM
kill $animpid > /dev/null 2>&1
#animate_clear
printf "%s %s" "$pre" "$post" >&2
tput init
echo ""
else
ffmpeg \
-video_size $size \