Add --multi-line and --title options to termux-dialog
[termux-packages] / packages / termux-api / termux-camera-photo
1 #!/bin/sh
2
3 set -e -u
4
5 show_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
13 PARAMS=""
14 O=`getopt -l camera: -l help -l size -- c:hs: "$@"`
15 eval set -- "$O"
16 while true; do
17 case "$1" in
18 -c|--camera) PARAMS="$PARAMS --es 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;;
23 esac
24 done
25
26 if [ $# != 1 ]; then show_usage; exit 1; fi
27
28 touch $1
29 PARAMS="$PARAMS --es file `realpath $1`"
30
31 @TERMUX_API@ CameraPhoto $PARAMS