pastoob: Add "info" command
This commit is contained in:
parent
e4d4ed206f
commit
45ba413a4b
1 changed files with 20 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2011 Laurent Bachelier
|
# Copyright(C) 2011-2014 Laurent Bachelier
|
||||||
#
|
#
|
||||||
# This file is part of weboob.
|
# This file is part of weboob.
|
||||||
#
|
#
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import codecs
|
import codecs
|
||||||
|
|
@ -46,6 +44,25 @@ class Pastoob(ReplApplication):
|
||||||
self.load_config()
|
self.load_config()
|
||||||
return ReplApplication.main(self, argv)
|
return ReplApplication.main(self, argv)
|
||||||
|
|
||||||
|
def do_info(self, line):
|
||||||
|
"""
|
||||||
|
info ID [ID2 [...]]
|
||||||
|
|
||||||
|
Get information about pastes.
|
||||||
|
"""
|
||||||
|
if not line:
|
||||||
|
print >>sys.stderr, 'This command takes an argument: %s' % self.get_command_help('info', short=True)
|
||||||
|
return 2
|
||||||
|
|
||||||
|
self.start_format()
|
||||||
|
for _id in line.split(' '):
|
||||||
|
paste = self.get_object(_id, 'get_paste', ['id', 'title', 'language', 'public', 'contents'])
|
||||||
|
if not paste:
|
||||||
|
print >>sys.stderr, 'Paste not found: %s' % _id
|
||||||
|
|
||||||
|
self.format(paste)
|
||||||
|
|
||||||
|
|
||||||
def do_get(self, line):
|
def do_get(self, line):
|
||||||
"""
|
"""
|
||||||
get ID
|
get ID
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue