Back to index

python-cliapp  1.20120630
Public Member Functions | Public Attributes
example.ExampleApp Class Reference
Inheritance diagram for example.ExampleApp:
Inheritance graph
[legend]
Collaboration diagram for example.ExampleApp:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def add_settings
def process_inputs
def process_input_line

Public Attributes

 matches

Detailed Description

A little fgrep-like tool.

Definition at line 29 of file example.py.


Member Function Documentation

Definition at line 33 of file example.py.

00033 
00034     def add_settings(self):
00035         self.settings.string_list(['pattern', 'e'], 
00036                                   'search for regular expression PATTERN',
00037                                    metavar='REGEXP')
00038 
00039         self.settings.boolean(['dummy'], 'this setting is ignored',
00040                               group='Test Group')

def example.ExampleApp.process_input_line (   self,
  name,
  line 
)

Definition at line 48 of file example.py.

00048 
00049     def process_input_line(self, name, line):
00050         logging.debug('processing %s:%s' % (name, self.lineno))
00051         for pattern in self.settings['pattern']:
00052             if pattern in line:
00053                 self.output.write('%s:%s: %s' % (name, self.lineno, line))
00054                 self.matches += 1
00055                 logging.debug('Match: %s line %d' % (name, self.lineno))
    
def example.ExampleApp.process_inputs (   self,
  args 
)

Definition at line 43 of file example.py.

00043 
00044     def process_inputs(self, args):
00045         self.matches = 0
00046         cliapp.Application.process_inputs(self, args)
00047         self.output.write('There were %s matches.\n' % self.matches)


Member Data Documentation

Definition at line 44 of file example.py.


The documentation for this class was generated from the following file: