summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <f-p@gmx.at>2009-08-02 22:52:28 +0200
committerFlorian Pritz <f-p@gmx.at>2009-08-02 22:52:28 +0200
commite30970a53b2dfd103634501e956ee9389022f585 (patch)
treea5a00e0aa86d220b07048e8bd2e2abf23ba97d67
parentd790d815b52de3cb28ece28a30a2cbcc05323307 (diff)
downloadbin-e30970a53b2dfd103634501e956ee9389022f585.tar.gz
bin-e30970a53b2dfd103634501e956ee9389022f585.tar.xz
upstream update
-rwxr-xr-xix12
1 files changed, 10 insertions, 2 deletions
diff --git a/ix b/ix
index d510bd7..1dfd22c 100755
--- a/ix
+++ b/ix
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-''' [cat |] %prog [-g id | -d id | file1 file2 ...] '''
+''' [cat |] %prog [-g id | -d id | [-i n1 id1 .. -i nN idN] file1 .. fileN] '''
-__version__ = '0.2'
+__version__ = '0.3'
import netrc, os, sys
@@ -49,6 +49,8 @@ if __name__ == '__main__':
description=auth.__doc__)
parser.add_option('-g', '--get', help='get paste identified by ID')
parser.add_option('-d', '--delete', help='delete paste identified by ID')
+ parser.add_option('-i', '--id', action='append', nargs=2,
+ help='two params (N, ID) replace paste ID with file N')
opts, args = parser.parse_args()
if opts.get:
print urlopen('http://ix.io/%s' % (opts.get)).read().strip()
@@ -60,4 +62,10 @@ if __name__ == '__main__':
data['rm'] = opts.delete
else:
data.update(mkreq(args))
+ if opts.id:
+ for i in opts.id:
+ try:
+ data['id:%d' % int(i[0])] = i[1]
+ except ValueError:
+ parser.error('invalid file number "%s" in --id option' % i[0])
print urlopen('http://ix.io', urlencode(data)).read().strip()