diff --git a/catboxuploader b/catboxuploader index 51a1d45..fcf1a76 100644 --- a/catboxuploader +++ b/catboxuploader @@ -18,13 +18,31 @@ esac } +clip() { + qdbus org.kde.klipper /klipper setClipboardContents "$(cat < /dev/stdin)" +} + main(){ uploadtime echo "uploading..." -curl -F "reqtype=fileupload" -F "time=$time" -F "fileToUpload=@$filename" https://litterbox.catbox.moe/resources/internals/api.php +curl -F "reqtype=fileupload" -F "time=$time" -F "fileToUpload=@$filename" https://litterbox.catbox.moe/resources/internals/api.php | clip } -[ -z "$1" ] && echo -e "no file provided\nusage is catboxuploader yourfilehere\nsuch as: catboxuploader 123.txt" || main + + +[ -z "$1" ] && { +echo -e "no file provided\nusage is catboxuploader yourfilehere\nsuch as: catboxuploader 123.txt" +exit 1 +} + + +[ "$#" -gt 1 ] && { +echo -e "error too many arguments\nonly 1 file may be uploaded at at time" +exit 1 +} + + +main && echo "uploaded" \ No newline at end of file