From 45ba413a4b188786dc98f7d051822f4969d3a522 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Sat, 22 Mar 2014 22:27:58 +0100 Subject: [PATCH] pastoob: Add "info" command --- weboob/applications/pastoob/pastoob.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/weboob/applications/pastoob/pastoob.py b/weboob/applications/pastoob/pastoob.py index 4757d50d..1b0876ac 100644 --- a/weboob/applications/pastoob/pastoob.py +++ b/weboob/applications/pastoob/pastoob.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright(C) 2011 Laurent Bachelier +# Copyright(C) 2011-2014 Laurent Bachelier # # This file is part of weboob. # @@ -18,8 +18,6 @@ # along with weboob. If not, see . - - import os import sys import codecs @@ -46,6 +44,25 @@ class Pastoob(ReplApplication): self.load_config() 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): """ get ID