summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Morris <kevr@0cost.org>2020-10-18 20:08:25 -0700
committerKevin Morris <kevr@0cost.org>2020-10-18 20:08:25 -0700
commitd8f26f7afd68b50eeaf859674b7c4b14f62bd07d (patch)
treeb6c6aeefa61cb1e8ad9605bcc8e50d73408325e1
parent36e723bcdd89bc3d1111fab5510d41a0a4b859f3 (diff)
downloadaur-d8f26f7afd68b50eeaf859674b7c4b14f62bd07d.tar.gz
Update sprunge to 0.1.3.
- Remove VCS pkgver. - Added --clipboard, an option that copies your sprunge URL to a clipboard. - Added --clipboard-command, the command used to copy the URL to a clipboard, default: 'xclip -sel primary'. Signed-off-by: Kevin Morris <kevr@0cost.org>
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD10
-rwxr-xr-xsprunge30
3 files changed, 35 insertions, 13 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 016393b..51a87b1 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,13 +1,15 @@
pkgbase = sprunge
pkgdesc = Upload data to sprunge.us via stdin
- pkgver = r2.a2b92dd
+ pkgver = 0.1.3
pkgrel = 1
url = https://github.com/kevr/sprunge
- arch = any
+ arch = i686
+ arch = x86_64
+ arch = armv6h
license = GPL2
depends = python
source = sprunge
- sha256sums = 7c65273804d26a24c1dcda83a559315b9f501013d3d77d7d140f882f05eb2b33
+ sha256sums = 5a9ff1ff05fca02df5b88dcb052bee1afca7ffa8290845ec94c1b8b61cad4ecf
pkgname = sprunge
diff --git a/PKGBUILD b/PKGBUILD
index 3d42154..66595fa 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,21 +1,17 @@
pkgname='sprunge'
-pkgver=r2.a2b92dd
+pkgver='0.1.3'
pkgrel=1
pkgdesc='Upload data to sprunge.us via stdin'
license=('GPL2')
url='https://github.com/kevr/sprunge'
-arch=('any')
+arch=('i686' 'x86_64' 'armv6h')
depends=('python')
source=('sprunge')
sha256sums=(
- '7c65273804d26a24c1dcda83a559315b9f501013d3d77d7d140f882f05eb2b33'
+ '5a9ff1ff05fca02df5b88dcb052bee1afca7ffa8290845ec94c1b8b61cad4ecf'
)
-pkgver() {
- printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
-}
-
package()
{
install -Dm755 "${srcdir}/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
diff --git a/sprunge b/sprunge
index c0c09df..6985691 100755
--- a/sprunge
+++ b/sprunge
@@ -1,13 +1,15 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Project: sprunge
-# Author: kevr <kevr@nixcode.us>
+# Author: kevr <kevr@0cost.org>
# Description: A tool which uploads data from stdin to sprunge.us
# Copyright (C) 2014 Kevin Morris
import sys
import urllib.parse
import urllib.request
from select import select
+import argparse
+from subprocess import Popen
## Voila hardcoded settings~
url = "http://sprunge.us"
@@ -23,6 +25,19 @@ def quit(code, msg):
## Sorry for the C-style functions, I prefer them
def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--clipboard-command",
+ dest="clipboard_command",
+ default="xclip -sel primary",
+ help="Command to use for clipboard pipe.")
+ parser.add_argument("--clipboard", "-c",
+ dest="clipboard",
+ action="store_const",
+ const=True,
+ default=False,
+ help="Copy URL to the primary clipboard.")
+ args = parser.parse_args()
+
if not has_data(sys.stdin):
return quit(1, "sprunge: no data given via stdin")
@@ -45,8 +60,17 @@ def main():
response = reply.read().decode("UTF-8")
reply.close()
- # End the program by printing out sprunge's response
- print(response.rstrip())
+ response = response.rstrip()
+ print(response)
+
+ # If --clipboard was given, additionally use --clipboard-command
+ # to save the resulting URL to the clipboard.
+ if args.clipboard:
+ proc = Popen([
+ "/bin/sh", "-c",
+ f'echo "{response}" | {args.clipboard_command}'
+ ])
+ proc.wait()
return 0