This commit makes the script more resistant to naughty filenames.
The script now depends on bash for the following features:
- Arrays
Correctly creating and passing argument lists is now simple
- Parameter transformation
`${parameter@Q}` makes it easy to correctly quote a string so that it
can be safely re-evaluated by the interpreter later.
On iTerm, the shell command used to render the preview is now passed to
osascript via a named pipe: `$FIFO_OSASCRIPT`. By not embedding the
shell command directly, we now no longer need to worry about osascript's
quoting rules. It's not perfect, because $SHELL and $TMPDIR might
contain naughty characters, but it's quite unlikely to happen.
the rename plugin always asks for "selection vs current" even when -u
flag is active. pass it to the plugin via `NNN_PREFER_SELECTION` so that
there's less distracting prompts.
Problem: List of environment variables is copied for each previewer.
Environment variable names are too general.
Solution: Parameterize environment variable flags with static list of
variables. Prepend user-facing variables with `NNN_`.
* plugins/nmount: keep `while` & `do` on one line for consistency
* plugins/nmount: sync only that device, which user wants to unmount
* plugins/nmount: replace all instances of `$dev` with `/dev/$dev`
* plugins/nmount: add `--no-user-interaction` option to `udisksctl`
Otherwise the user will be asked for authentication each time he wants
to unmount, say, HDD, since `udisksctl` will try to power it off.
* plugins/nmount: try to mount only existing block devices
* plugins/nmount: do not invoke `lsblk` immediately after mounting
Sometimes `lsblk` fails to provide mountpoint in such a short time frame.
* plugins/nmount: simplify pipe
* plugins/nmount: keep `echo` arguments in a single pair of quotes
* plugins/nmount: report mountpoint only if mounting was successful
- Work with multiple connected devices by sending files to the first
device
- Support multi-files selection
- Support sending hovered file in case no file is selected
Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: Arun Prakash Jana <engineerarun@gmail.com>