improve ls command in handjoob

This commit is contained in:
Bezleputh 2013-08-20 18:03:14 +02:00
commit b4c93587b4
10 changed files with 54 additions and 71 deletions

View file

@ -84,6 +84,7 @@ class Handjoob(ReplApplication):
'job_advert': JobAdvertFormatter,
}
COMMANDS_FORMATTERS = {'search': 'job_advert_list',
'ls': 'job_advert_list',
'info': 'job_advert',
}
@ -99,6 +100,17 @@ class Handjoob(ReplApplication):
for backend, job_advert in self.do('search_job', pattern):
self.cached_format(job_advert)
@defaultcount(10)
def do_ls(self, line):
"""
advanced search
Search for an advert matching to advanced filters.
"""
self.change_path([u'advanced'])
for backend, job_advert in self.do('advanced_search_job'):
self.cached_format(job_advert)
def complete_info(self, text, line, *ignored):
args = line.split(' ')
if len(args) == 2:

View file

@ -81,6 +81,13 @@ class ICapJob(IBaseCap):
"""
raise NotImplementedError()
def advanced_search_job(self):
"""
Iter results of an advanced search
:rtype: iter[:class:`BaseJobAdvert`]
"""
def get_job_advert(self, _id, advert=None):
"""
Get an announce from an ID.