graphviz: Update from 2.38.0 to 2.40.1
[termux-packages] / packages / termux-api / termux-camera-photo
CommitLineData
cc1ae02e 1#!/bin/sh
59f0d218
FF
2set -e -u
3
bea93fbd 4SCRIPTNAME=termux-camera-photo
59f0d218 5show_usage () {
bea93fbd
FF
6 echo "Usage: termux-camera-photo [-c camera-id] output-file"
7 echo "Take a photo and save it to a file in JPEG format."
bea93fbd 8 echo " -c camera-id ID of the camera to use (see termux-camera-info), default: 0"
bea93fbd 9 exit 0
59f0d218
FF
10}
11
bea93fbd 12
2aa217bf 13PARAMS=""
bea93fbd
FF
14while getopts :hc: option
15do
16 case "$option" in
17 h) show_usage;;
18 c) PARAMS="--es camera $OPTARG";;
19 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
20 esac
59f0d218 21done
bea93fbd 22shift $(($OPTIND-1))
59f0d218 23
bea93fbd
FF
24if [ $# = 0 ]; then echo "$SCRIPTNAME: missing file argument"; exit 1; fi
25if [ $# != 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
2e395b58 26
59f0d218 27touch $1
2aa217bf 28PARAMS="$PARAMS --es file `realpath $1`"
59f0d218 29
cc1ae02e 30@TERMUX_API@ CameraPhoto $PARAMS