diff options
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 4 | ||||
-rwxr-xr-x | up | 28 |
3 files changed, 17 insertions, 17 deletions
@@ -9,7 +9,7 @@ pkgbase = upaste optdepends = xclip: Command line interface to the X11 clipboard source = up source = UNLICENSE - sha256sums = 2d29aa3d2d9a4e36c4a0205fa3c5c630b26bfbb11c0708452ab8cd766b33d257 + sha256sums = 4e668585d0424b86aa98f7349177339966955adb1aeb39ca34205c468d5b3c1c sha256sums = 6b0382b16279f26ff69014300541967a356a666eb0b91b422f6862f6b7dad17e pkgname = upaste @@ -1,7 +1,7 @@ # Maintainer: Jonathan Kirszling <jkirsz@gmail.com> pkgname=upaste pkgrel=1 -pkgver=0.1.1 +pkgver=0.1.2 pkgdesc="Paste and upload files on x0.at" arch=('any') url="https://github.com/eoli3n/$pkgname" @@ -10,7 +10,7 @@ optdepends=('wl-clipboard: Command-line copy/paste utilities for Wayland' 'xclip: Command line interface to the X11 clipboard') source=("up" "UNLICENSE") -sha256sums=("2d29aa3d2d9a4e36c4a0205fa3c5c630b26bfbb11c0708452ab8cd766b33d257" +sha256sums=("4e668585d0424b86aa98f7349177339966955adb1aeb39ca34205c468d5b3c1c" "6b0382b16279f26ff69014300541967a356a666eb0b91b422f6862f6b7dad17e") package() { @@ -4,7 +4,7 @@ # Vars -AUTOCOPY=1 +autocopy=1 # Functions @@ -38,13 +38,13 @@ upload () { # Set vars local args - local extension + local ext local file - # Set extension - if [ -n "$EXTENSION" ] + # If extension is set with -t option, set curl ext + if [ -n "$extension" ] then - extension="filename=.$EXTENSION" + ext="filename=.$extension" fi if [ -z "$1" ] @@ -52,10 +52,10 @@ upload () { # If argument is empty, upload stdin local file="file=@-" - # If extension not set, set .txt - if [ -z "$extension" ] + # If curl ext not set, set it to .txt + if [ -z "$ext" ] then - extension="filename=.txt" + ext="filename=.txt" fi else @@ -63,7 +63,7 @@ upload () { local file="file=@\"$1\"" fi - args="$file;$extension" + args="$file;$ext" # Curl call curl -s -F "$args" 'https://x0.at/' @@ -71,7 +71,7 @@ upload () { autocopy () { # If xorg or wayland is running - if env | grep 'DISPLAY' >/dev/null 2>&1 + if [ -n 'DISPLAY' ] then # If xclip is installed if which xclip >/dev/null 2>&1 @@ -87,7 +87,7 @@ autocopy () { is_file () { # Test if first argument is an existing file - if [ ! -f "$1" ] + if [ ! -f "$(readlink $1)" ] then echo "File \"$1\" does not exist or is not a regular file" exit 2 @@ -108,7 +108,7 @@ main () { then url=$(upload) # Force a newline - echo -e "\n" + printf "\n" # Else upload argument and save url else # Test if file exists and is a regular file @@ -134,7 +134,7 @@ main () { echo "$url" # If autocopy is set - if [ "$AUTOCOPY" == "1" ] + if [ "$autocopy" = "1" ] then # Autocopy url autocopy "$url" @@ -154,7 +154,7 @@ do exit ;; t) - EXTENSION=${OPTARG} + extension=${OPTARG} ;; *) usage |