Compare commits

...

2 commits

Author SHA1 Message Date
726d20b8f7 upload -> put 2024-07-13 19:08:13 -04:00
09c1d987f2 Add download function 2024-07-13 19:07:41 -04:00

View file

@ -94,12 +94,15 @@ function bambu_file() {
ls)
bambu_ls "$@"
;;
upload)
bambu_upload "$@"
put])
bambu_put "$@"
;;
rm)
bambu_rm "$@"
;;
get)
bambu_get "$@"
;;
*)
die "Unknown subcommand $subcommand"
;;
@ -133,7 +136,7 @@ function bambu_ls() {
fi
}
function bambu_upload() {
function bambu_put() {
local directory="$(preprocess_directory_path "$2")"
curl_ftps_command "$directory" -T "$1"
}
@ -143,6 +146,32 @@ function bambu_rm() {
curl_ftps_command "" -Q "DELE /$file" > /dev/null 2>&1 || echo "Failed to delete file $file"
}
function bambu_get() {
local file=""
local output_path="$PWD"
while [ ! -z "$1" ]; do
case "$1" in
-o|--output)
output_path="$2"
shift
shift
;;
-*)
die "Unknown option $1"
;;
*)
file="$1"
shift
;;
esac
done
[ -z "$file" ] && die "Path to file not specified"
curl_ftps_command "$file" -o "$output_path/$(basename "$file")"
}
function bambu_print() {
local subcommand="$1"
shift