32 lines
761 B
Bash
Executable File
32 lines
761 B
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
usage () {
|
|
|
|
echo "$0 [Path To File]"
|
|
echo "Ex : $0 /home/guillaume/File.cast"
|
|
echo ".cast extension is mandatory"
|
|
exit
|
|
|
|
}
|
|
|
|
[[ -z $1 ]] && usage
|
|
|
|
Dir=$(realpath $(dirname $1))
|
|
OrigFile=$(basename $1)
|
|
BaseFile=$(echo $OrigFile| sed 's/.cast//g')
|
|
DestFile=$(basename $1| sed 's/cast/gif/g')
|
|
|
|
|
|
|
|
docker run --rm -it --hostname ${BaseFile} -v "${HOME}/.config/asciinema:/root/.config/asciinema" -v ${Dir}:/data docker.tuxme.net/term2gif-run rec /data/${OrigFile}
|
|
|
|
docker run --rm -it -u $(id -u):$(id -g) -v ${Dir}:/data docker.tuxme.net/term2gif-gif ${OrigFile} ${DestFile}
|
|
|
|
echo "
|
|
##################################################
|
|
cast file : ${Dir}/${OrigFile}
|
|
cast file : ${Dir}/${DestFile}
|
|
##################################################
|
|
"
|