Skip to content

Commit aaa43bd

Browse files
committed
Add --version option
1 parent 3c5b488 commit aaa43bd

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

xcrecord

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,34 @@
22

33
output=$1
44
tmp_file=$(mktemp)
5+
name=$(basename "$0")
56

6-
if [ $# -eq 0 ]; then
7-
echo "usage: $(basename "$0") file ..."
8-
exit 1
9-
fi
7+
show_usage() {
8+
echo "usage: $name file ..."
9+
}
1010

11-
xcrun simctl io booted recordVideo "$tmp_file"
11+
show_version() {
12+
echo "$name version 1.0.0"
13+
}
1214

13-
ffmpeg -i "$tmp_file" -vf scale="w=-1:h=480:force_original_aspect_ratio=decrease" -pix_fmt rgb24 -r 10 -f gif - \
14-
| gifsicle --optimize=3 > "$output"
15+
xcrecord() {
16+
xcrun simctl io booted recordVideo "$tmp_file"
1517

16-
rm -r "$tmp_file"
18+
ffmpeg -i "$tmp_file" -vf scale="w=-1:h=480:force_original_aspect_ratio=decrease" -pix_fmt rgb24 -r 10 -f gif - \
19+
| gifsicle --optimize=3 > "$output"
20+
21+
rm -r "$tmp_file"
22+
}
23+
24+
case $1 in
25+
-v|--version|version)
26+
show_version
27+
exit
28+
;;
29+
?*)
30+
xcrecord
31+
;;
32+
*)
33+
show_usage
34+
;;
35+
esac

0 commit comments

Comments
 (0)