commit 39d50512dd99fba2b7c1ba4e5d0e86b7e674ad92
parent b6efbb67fe386ff4ed9622a672eda0bf60a52bf6
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Mon, 28 Oct 2019 11:26:11 +0100
Add --list option to upload script
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/.local/bin/upload b/.local/bin/upload
@@ -24,6 +24,7 @@ show_help() {
echo " without changing its width-to-height ratio"
echo " -s, --sharpen if an image, sharpen all FILES"
echo " -g, --get get previously uploaded FILES instead of uploading"
+ echo " -l, --list list previously uploaded files"
echo " -d, --delete delete previously uploaded FILES instead of uploading"
echo " --get and --delete can be used together"
echo "the optional operations are performed in the order listed above."
@@ -102,6 +103,10 @@ delete_file() {
ssh "$user"@"$host" "rm ${remotedir}/$1"
}
+list_uploads() {
+ ssh "$user"@"$host" "ls -lah ${remotedir}/"
+}
+
die() {
printf '%s\n' "$1" >&2
exit 1
@@ -141,6 +146,10 @@ while :; do
-d|--delete)
delete=1
;;
+ -l|--list)
+ list_uploads
+ exit 0
+ ;;
--) # end all options
shift
break