Pastoob fixes
Do not use print (as it add a newline), fix the wanted fields, use "get" instead of "show".
This commit is contained in:
parent
2c6d5d4e70
commit
5c7eaa3151
1 changed files with 6 additions and 5 deletions
|
|
@ -38,22 +38,23 @@ class Pastoob(ReplApplication):
|
||||||
self.load_config()
|
self.load_config()
|
||||||
return ReplApplication.main(self, argv)
|
return ReplApplication.main(self, argv)
|
||||||
|
|
||||||
def do_show(self, _id):
|
def do_get(self, _id):
|
||||||
"""
|
"""
|
||||||
show ID
|
get ID
|
||||||
|
|
||||||
Get a paste contents.
|
Get a paste contents.
|
||||||
"""
|
"""
|
||||||
if not _id:
|
if not _id:
|
||||||
print >>sys.stderr, 'This command takes an argument: %s' % self.get_command_help('show', short=True)
|
print >>sys.stderr, 'This command takes an argument: %s' % self.get_command_help('get', short=True)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
paste = self.get_object(_id, 'get_paste', ['title'])
|
paste = self.get_object(_id, 'get_paste', ['contents'])
|
||||||
except PasteNotFound:
|
except PasteNotFound:
|
||||||
print >>sys.stderr, 'Paste not found: %s' % _id
|
print >>sys.stderr, 'Paste not found: %s' % _id
|
||||||
return 2
|
return 2
|
||||||
if not paste:
|
if not paste:
|
||||||
print >>sys.stderr, 'Unable to handle paste: %s' % _id
|
print >>sys.stderr, 'Unable to handle paste: %s' % _id
|
||||||
return 3
|
return 3
|
||||||
print paste.contents
|
output = sys.stdout
|
||||||
|
output.write(paste.contents)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue