Grigoriy Petukhov  committed 998630b

remove analize feature; add default 320 chars output limit; add option for setup the output limit

  • Participants
  • Parent commits 3b2edce

Comments (0)

Files changed (3)


File example_patterns

                                             'core\.\d+$', '\.pyc$')]
 BACKUP_RE = re.compile('\.\d\d\d~$')
 # Thank's to ack for this list
 def TYPES():
         self.stat = {'all': 0}
         self.types_cache = None
         self.filenames = False
+        self.output_limit = DEFAULT_OUTPUT_LIMIT
 def build_lang_options(parser):
                       default=False, help='verbose output')
     parser.add_option('-n', '--filenames', action='store_true',
                       default=False, help='show only file names (only for search)')
+    parser.add_option('--output-limit', type='int',
+                      help='the maximem length of output line before it will be truncated')
         print 'allow exts:', config.allow_exts
         print 'disallow exts:', config.disallow_exts
+    if not opts.output_limit is None:
+        config.output_limit = opts.output_limit
     if not
         if opts.replace:
             parser.error('Replace option could be specified only with search option')
     Search pattern in each line of file.
-    LIMIT = get_terminal_width()
     started = False
     for count, line in enumerate(file(path)):
                 if config.filenames:
                 started = True
-            if len(line) <= LIMIT:
+            if len(line) <= config.output_limit:
                 print '%d:%s' % (number, config.term.highlight(line.rstrip('\n\r'), ('BLACK', 'BG_YELLOW'),
-                print '%d:LINE IS TOO LONG (>%d)' % (number, LIMIT)
+                print '%d:LINE IS TOO LONG (>%d)' % (number, config.output_limit)
     if started: