Added file filter to files Cli_Presentation
authorEugene Gagarin <mosfet07@ya.ru>
Fri, 15 May 2009 08:53:28 +0000 (12:53 +0400)
committerEugene Gagarin <mosfet07@ya.ru>
Fri, 15 May 2009 08:53:28 +0000 (12:53 +0400)
src/files/search.py
src/main.py

index 59228f8..cafc0f3 100755 (executable)
@@ -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
index 453d264..0fc7332 100755 (executable)
@@ -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()