Skip to content

Commit f793683

Browse files
authored
Merge pull request #31 from gburch/smsInboxTypeParam
Added message type option and help
2 parents f6af461 + 680c3d8 commit f793683

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

scripts/termux-sms-inbox

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,37 @@ set -u
33

44
PARAM_LIMIT=10
55
PARAM_OFFSET=0
6+
PARAM_TYPE=1
67
PARAMS=""
78

89
SCRIPTNAME=termux-sms-inbox
910
show_usage () {
10-
echo "Usage: termux-sms-inbox [-d] [-l limit] [-n] [-o offset]"
11+
echo "Usage: termux-sms-inbox [-d] [-l limit] [-n] [-o offset] [-t type]"
1112
echo "List received SMS messages."
1213
echo " -d show dates when messages were created"
1314
echo " -l limit offset in sms list (default: $PARAM_LIMIT)"
1415
echo " -n show phone numbers"
1516
echo " -o offset offset in sms list (default: $PARAM_OFFSET)"
17+
echo " -t type the type of messages to return (default: $PARAM_TYPE)"
18+
echo " 0:ALL, 1:INBOX, 2:SENT, 3:DRAFT, 4:OUTBOX "
1619
exit 0
1720
}
1821

19-
while getopts :hdl:no: option
22+
while getopts :hdlt:no: option
2023
do
2124
case "$option" in
2225
h) show_usage;;
2326
d) PARAMS="$PARAMS --ez show-dates true";;
2427
l) PARAM_LIMIT=$OPTARG;;
2528
n) PARAMS="$PARAMS --ez show-phone-numbers true";;
2629
o) PARAM_OFFSET=$OPTARG;;
30+
t) PARAM_TYPE=$OPTARG;;
2731
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
2832
esac
2933
done
3034
shift $(($OPTIND-1))
3135

3236
if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
3337

34-
PARAMS="$PARAMS --ei offset $PARAM_OFFSET --ei limit $PARAM_LIMIT"
38+
PARAMS="$PARAMS --ei offset $PARAM_OFFSET --ei limit $PARAM_LIMIT --ei type $PARAM_TYPE"
3539
/data/data/com.termux/files/usr/libexec/termux-api SmsInbox $PARAMS

0 commit comments

Comments
 (0)