termux-api
termux-api copied to clipboard
more features for termux-storage-get
This goal of this request is to enrich termux-storage-get to what "Open ..." and "Open Folder ..." usually do in PC, while keeping backward compatibility.
- high backward compatibility (
termux-storage-get output-name
works as usual) - print URIs in JSON array (or line format with -l), resolves part of discussion in #199
- when output-name is not present, only print out URIs
- synchronous call (wait until finish, should resovle #367, part of #199
- open folder
- persistable permission grant (persist after reboot)
- supprot to get multiple file (accompany with output-name patterns like %d, %8d, %08d)
- specify MIME type
See show_usage()
of pull request on termux-api-package for more detailed usage.
The folder function highly resembles SAF one, but termux-storage-get
focuses on the concept of "Open ...", or perhaps termux-storage-get
should be better do this job.
Also, let's consider this use case: user can pick one or multiple file(s) calling termux-storage-get
, get URI(s) from stdout, and then manipulate the file URI(s) with termux-saf-*
functions.
Therefore, please consider to adopt the changes, perhaps partly. Or even integrating it SAF as something like termux-saf-open
would also be great.
I haven't tried it out but the code looks good to me.
Wow this looks super useful. So many missing features have been implemented. Any chance we get this thing merged?