termux-api: Add termux-toast
[termux-packages] / packages / termux-api / termux-camera-photo
... / ...
CommitLineData
1#!/system/bin/sh
2
3set -e -u
4
5show_usage () {
6 echo "usage: termux-camera-photo [OPTIONS] <output-file>"
7 echo ""
8 echo "Take a photo and save it in a file. Valid options:"
9 echo " -c, --camera <camera-id> the ID of the camera to use"
10 echo "Use termux-camera-info for information about available camera IDs."
11}
12
13PARAMS=""
14O=`getopt -l camera: -l help -l size -- c:hs: "$@"`
15eval set -- "$O"
16while true; do
17case "$1" in
18 -c|--camera) PARAMS="$PARAMS --ei camera $2"; shift 2;;
19 -h|--help) show_usage; exit 0;;
20 -s|--size) PARAMS="$PARAMS --ei size_index $2"; shift 2;;
21 --) shift; break;;
22 *) echo Error; exit 1;;
23esac
24done
25
26touch $1
27PARAMS="$PARAMS --es file `realpath $1`"
28
29termux-api CameraPhoto $PARAMS