mirror of
https://github.com/jarun/nnn.git
synced 2025-01-28 19:56:48 +00:00
plugins/upload: handle selection using ffsend
This commit is contained in:
parent
3359b8f7cd
commit
4bb7ffcd4a
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# Description: Upload to Firefox Send if ffsend is found, else
|
# Description: Selections are uploaded using Firefox Send
|
||||||
|
# For single files:
|
||||||
|
# Upload to Firefox Send if ffsend is found, else
|
||||||
# Paste contents of a text a file http://ix.io
|
# Paste contents of a text a file http://ix.io
|
||||||
# Upload a binary file to file.io
|
# Upload a binary file to file.io
|
||||||
#
|
#
|
||||||
|
@ -11,6 +13,18 @@
|
||||||
# Shell: POSIX compliant
|
# Shell: POSIX compliant
|
||||||
# Author: Arun Prakash Jana
|
# Author: Arun Prakash Jana
|
||||||
|
|
||||||
|
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||||
|
if [ -s "$selection" ]; then
|
||||||
|
if type ffsend >/dev/null 2>&1; then
|
||||||
|
# File name will be randomized foo.tar
|
||||||
|
xargs -0 < "$selection" ffsend u
|
||||||
|
else
|
||||||
|
printf "ffsend is required to upload selection."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clear selection
|
||||||
|
printf "-" > "$NNN_PIPE"
|
||||||
|
else
|
||||||
if [ -n "$1" ] && [ -s "$1" ]; then
|
if [ -n "$1" ] && [ -s "$1" ]; then
|
||||||
if type ffsend >/dev/null 2>&1; then
|
if type ffsend >/dev/null 2>&1; then
|
||||||
ffsend -fiq u "$1"
|
ffsend -fiq u "$1"
|
||||||
|
@ -26,5 +40,6 @@ if [ -n "$1" ] && [ -s "$1" ]; then
|
||||||
else
|
else
|
||||||
printf "empty file!"
|
printf "empty file!"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
read -r _
|
read -r _
|
||||||
|
|
Loading…
Reference in a new issue