Compare commits
No commits in common. "83f2a98d79014b6715847ecef87e44d14e0915f3" and "ad6c9379f091df31879d9631761b48d1632951d1" have entirely different histories.
83f2a98d79
...
ad6c9379f0
1 changed files with 13 additions and 49 deletions
62
bambu.sh
62
bambu.sh
|
@ -86,51 +86,9 @@ function bambu_status() {
|
||||||
mqtt_command '{"pushing": { "sequence_id": 1, "command": "pushall"}, "user_id":"1234567890"}'
|
mqtt_command '{"pushing": { "sequence_id": 1, "command": "pushall"}, "user_id":"1234567890"}'
|
||||||
}
|
}
|
||||||
|
|
||||||
function bambu_file() {
|
function bambu_lsdir() {
|
||||||
local subcommand="$1"
|
local directory="$(preprocess_directory_path "$1")"
|
||||||
shift
|
curl_ftps_command "$directory"
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
ls)
|
|
||||||
bambu_ls "$@"
|
|
||||||
;;
|
|
||||||
upload)
|
|
||||||
bambu_upload "$@"
|
|
||||||
;;
|
|
||||||
rm)
|
|
||||||
bambu_rm "$@"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
die "Unknown subcommand $subcommand"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
function bambu_ls() {
|
|
||||||
local is_file="false"
|
|
||||||
local path=""
|
|
||||||
|
|
||||||
while [ ! -z "$1" ]; do
|
|
||||||
case "$1" in
|
|
||||||
-f|--file)
|
|
||||||
is_file="true"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
path="$1"
|
|
||||||
shift
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$is_file" == "true" ]; then
|
|
||||||
path="$(preprocess_file_path "$path")"
|
|
||||||
curl_ftps_command "$(preprocess_directory_path "$(dirname "$path")")" -s | grep "$(basename "$path")"
|
|
||||||
else
|
|
||||||
path="$(preprocess_directory_path "$path")"
|
|
||||||
curl_ftps_command "$(preprocess_directory_path "$path")"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function bambu_upload() {
|
function bambu_upload() {
|
||||||
|
@ -138,9 +96,9 @@ function bambu_upload() {
|
||||||
curl_ftps_command "$directory" -T "$1"
|
curl_ftps_command "$directory" -T "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function bambu_rm() {
|
function bambu_rmfile() {
|
||||||
local file="$(preprocess_file_path "$1")"
|
local file="$(preprocess_file_path "$1")"
|
||||||
curl_ftps_command "" -Q "DELE /$file" > /dev/null 2>&1 || echo "Failed to delete file $file"
|
curl_ftps_command "$file" -Q "DELE /$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
function bambu_print() {
|
function bambu_print() {
|
||||||
|
@ -267,8 +225,14 @@ case "$command" in
|
||||||
status)
|
status)
|
||||||
bambu_status "$@"
|
bambu_status "$@"
|
||||||
;;
|
;;
|
||||||
file)
|
lsdir)
|
||||||
bambu_file "$@"
|
bambu_lsdir "$@"
|
||||||
|
;;
|
||||||
|
upload)
|
||||||
|
bambu_upload "$@"
|
||||||
|
;;
|
||||||
|
rmfile)
|
||||||
|
bambu_rmfile "$@"
|
||||||
;;
|
;;
|
||||||
print)
|
print)
|
||||||
bambu_print "$@"
|
bambu_print "$@"
|
||||||
|
|
Loading…
Add table
Reference in a new issue