-
Notifications
You must be signed in to change notification settings - Fork 424
Commit 6b7a800
committed
Added(termux-sms-list): Enhance API with new options and use
The following options have been added. Check `termux-sms-list --help` for examples and more info.
Alternate options:
- `--help` for `-h`.
- `--conversation-list` for `-c`.
- `--message-address` for `-f`.
- `--message-limit` for `-l`.
- `--message-offset` for `-o`.
- `--message-type` for `-t`.
New options:
- `-q` and `-v` options to control `TERMUX_API__LOG_LEVEL` for script, and `termux-api.c` in future.
- `--conversation-limit=<limit>`: The SQL limit for returned SMS conversations.
- `--conversation-offset=<offset>`: The SQL offset for returned SMS conversations.
- `--conversation-return-multiple-messages`: Return multiple SMS messages per conversation.
- `--conversation-return-nested-view`: Return a nested object view of conversations where each conversation contains an array of SMS messages with the conversation id as the key.
- `--conversation-return-no-order-reverse`: Return SMS conversations without reversing order of conversation sort.
- `--conversation-selection=<selection>`: The SQL selection for returned SMS conversations.
- `--conversation-sort-order=<order>`: The SMS conversations sort order as per SQL 'ORDER BY col1, col2, ... ASC|DESC' clause. Default value: 'date DESC'.
- `--message-return-no-order-reverse`: Return SMS messages without reversing order of message sort.
- `--message-selection=<selection>`: The SQL selection for returned SMS messages.
- `--message-sort-order=<order>`: The SMS messages sort order as per SQL 'ORDER BY col1, col2, ... ASC|DESC' clause. Default value: 'date DESC'.
The script has been refactored to a new format for the following reasons and now uses `bash` shell. The new format will be used by all termux-api scripts in future to provide safe and consistent API scripts. Some `FIXME` remain in the script that will be fixed in future when `make` build script is used in future after termux/termux-packages#18872 is merged.
- The use of bash is needed for bash shell array support for dynamically creating API command arguments array instead of using `$PARAMS` shell variable for storing arguments which splits on IFS characters when expanded without quotes, resulting in non-deterministic behaviour.
- Support for sourcing the script has been added so that external shell calls are not required for re-running the command for faster execution by calling `termux_api__sms_list__main()` function (saves ~10-15ms on Snapdragon 865 and ~40ms on Snapdragon 820). The `termux_api__*__(init|main|help|process_script_arguments|log_*) functions will exist in all API scripts to provide consistent calling mechanisms for user and third party programs.
- Logging support with multiple log levels as per `TERMUX_API__LOG_LEVEL`, which will be used by `termux-api.c` in future as well.
- Long arg options support and error handling for other short/long options
- Termux scoped environment variables and functions are used, and local/global variables as needed.bash instead of sh shell with a new script format1 parent b2cb6af commit 6b7a800Copy full SHA for 6b7a800
File tree
Expand file treeCollapse file tree
1 file changed
+611
-51
lines changedOpen diff view settings
Filter options
- scripts
Expand file treeCollapse file tree
1 file changed
+611
-51
lines changedOpen diff view settings
0 commit comments