diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-01-06 20:29:10 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-01-06 20:29:10 +0100 |
commit | 9b8354ebe8423c6fb4a61e7677f384dcdc75d888 (patch) | |
tree | 8d86fb0b6377fea118f21ccbfac897d9c6b2ee75 | |
parent | 77b21c2c66616b5edc384f3622e744e5b0d25195 (diff) |
profile: allow piping to ups()
-rw-r--r-- | dotfiles/profile | 9 |
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}" } |