File: record.sh

package info (click to toggle)
python-pyfunceble 4.2.29.dev-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,108 kB
  • sloc: python: 27,413; sh: 142; makefile: 27
file content (86 lines) | stat: -rw-r--r-- 1,866 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash

set -e

hash awk
hash pyfunceble

tmpDir="/tmp/pyfunceble-demos"

if [[ ! -d ${tmpDir} ]]
then
    mkdir -p "${tmpDir}"
fi

echo "Pre-warming for better recording performance"
pyfunceble --version >/dev/null

for file in "${@}"; do
    castFile="${tmpDir}/$(basename "${file}").cast"
    castTitle="$(fgrep "asciinema-title" ${file} | awk -v FS=": " '{ print $2}')"
    castColumns="$(fgrep "asciinema-cols" ${file} | awk -v FS=": " '{ print $2}')"
    castRows="$(fgrep "asciinema-rows" ${file} | awk -v FS=": " '{ print $2}')"

    if [[ -z "${castTitle}" ]]
    then
        castTitle="PyFunceble"
    fi

    if [[ -z "${castColumns}" ]]
    then
        castColumns=200
    fi

    if [[ -z "${castRows}" ]]
    then
        castRows=20
    fi

    rm -f "${castFile}"

    stty cols "${castColumns}" rows "${castRows}"
    asciinema rec -t "${castTitle}" -c "tuterm ${file} --mode demo" "${castFile}"
done
#!/usr/bin/env bash

set -e

hash awk
hash pyfunceble

tmpDir="/tmp/pyfunceble-demos"

if [[ ! -d ${tmpDir} ]]
then
    mkdir -p "${tmpDir}"
fi

echo "Pre-warming for better recording performance"
pyfunceble --version >/dev/null

for file in "${@}"; do
    castFile="${tmpDir}/$(basename "${file}").cast"
    castTitle="$(fgrep "asciinema-title" ${file} | awk -v FS=": " '{ print $2}')"
    castColumns="$(fgrep "asciinema-cols" ${file} | awk -v FS=": " '{ print $2}')"
    castRows="$(fgrep "asciinema-rows" ${file} | awk -v FS=": " '{ print $2}')"

    if [[ -z "${castTitle}" ]]
    then
        castTitle="PyFunceble"
    fi

    if [[ -z "${castColumns}" ]]
    then
        castColumns=200
    fi

    if [[ -z "${castRows}" ]]
    then
        castRows=20
    fi

    rm -f "${castFile}"

    stty cols "${castColumns}" rows "${castRows}"
    asciinema rec -t "${castTitle}" -c "tuterm ${file} --mode demo" "${castFile}"
done