From a12edbdf895ebe152f7e8d5aff33119d79a7512d Mon Sep 17 00:00:00 2001 From: Eugene Gagarin Date: Fri, 15 May 2009 12:53:28 +0400 Subject: [PATCH] Added file filter to files Cli_Presentation --- src/files/search.py | 3 ++- src/main.py | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/files/search.py b/src/files/search.py index 59228f8..cafc0f3 100755 --- a/src/files/search.py +++ b/src/files/search.py @@ -87,12 +87,13 @@ class Cli_Presentation(object): self.outtype = params['outtype'] self.start_path = params['start_path'] self.count = params['count'] + self.file_filter = params['file_filter'].split(';') self.stopit = False self.toplevel = None def get_data(self): - return self.outtype, self.start_path, int(self.count) + return self.outtype, self.start_path, int(self.count), self.file_filter def get_stopit(self): return False diff --git a/src/main.py b/src/main.py index 453d264..0fc7332 100755 --- a/src/main.py +++ b/src/main.py @@ -61,10 +61,17 @@ class Cli_Presentation(object): self.search = options.search - self.params = {} - self.params['outtype'] = options.output - self.params['ignore_dirs'] = config['files']['ignore_dirs'] ### - self.params['start_path'], self.params['count'] = options.params.split() + self.options = {} + self.options['outtype'] = options.output + self.options['ignore_dirs'] = config['files']['ignore_dirs'] + + self.params = options.params.split() + self.options['start_path'] = self.params[0] + self.options['count'] = self.params[1] + try: + self.options['file_filter'] = self.params[2] + except IndexError: + self.options['file_filter'] = '*.*' def _about(self, *a): print self.abstrac.comments @@ -76,7 +83,7 @@ class Cli_Presentation(object): def show_search_toplevel(self): search_module = __import__(self.search + '.search') - search_toplevel = search_module.search.Control('Cli', self.params).run() + search_toplevel = search_module.search.Control('Cli', self.options).run() def run(self): self.show_search_toplevel() -- 1.7.9.5