summaryrefslogtreecommitdiff
path: root/dotfiles/profile
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-01-06 20:29:10 +0100
committerAnton Khirnov <anton@khirnov.net>2021-01-06 20:29:10 +0100
commit9b8354ebe8423c6fb4a61e7677f384dcdc75d888 (patch)
tree8d86fb0b6377fea118f21ccbfac897d9c6b2ee75 /dotfiles/profile
parent77b21c2c66616b5edc384f3622e744e5b0d25195 (diff)
profile: allow piping to ups()
Diffstat (limited to 'dotfiles/profile')
-rw-r--r--dotfiles/profile9
1 files changed, 7 insertions, 2 deletions
diff --git a/dotfiles/profile b/dotfiles/profile
index c218116..749f360 100644
--- a/dotfiles/profile
+++ b/dotfiles/profile
@@ -30,8 +30,13 @@ fi
# ups.khirnov.net uploader
ups() {
- fname=$(basename "$1")
- url=$(curl -sS -E ~/.local/var/up/cert --data-binary "@$1" "https://ups.khirnov.net/${fname}")
+ if [ "$1" ]; then
+ fname=$(basename "$1")
+ else
+ fname="-"
+ fi
+
+ url=$(curl -sS -E ~/.local/var/up/cert --data-binary "@${fname}" "https://ups.khirnov.net/${fname}")
[ "${url}" ] && echo "${url}"
}