diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-02-19 11:12:55 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-02-19 11:12:55 +0000 |
commit | ad74f25c8b75b265f7e5b11f43414f846cafc369 (patch) | |
tree | f0d56bad17f5ad1359b2c0d815d9812d8a898f79 /example.py | |
parent | c59213e2e9dd7efc41ca23d96ab18032f614dc32 (diff) | |
download | cliapp-ad74f25c8b75b265f7e5b11f43414f846cafc369.tar.gz |
Update example to use string lists instead of plain strings.
Diffstat (limited to 'example.py')
-rw-r--r-- | example.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -25,11 +25,12 @@ class ExampleApp(cliapp.Application): '''A little fgrep-like tool.''' def add_settings(self): - self.add_string_setting(['pattern', 'e'], 'the pattern to search for') + self.add_string_list_setting(['pattern', 'e'], 'pattern to search for') def process_input_line(self, name, line): - if self['pattern'] in line: - self.output.write(line) + for pattern in self['pattern']: + if pattern in line: + self.output.write(line) ExampleApp(version='0.1.2').run() |