summaryrefslogtreecommitdiff
path: root/example.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-02-19 11:12:55 +0000
committerLars Wirzenius <liw@liw.fi>2011-02-19 11:12:55 +0000
commitad74f25c8b75b265f7e5b11f43414f846cafc369 (patch)
treef0d56bad17f5ad1359b2c0d815d9812d8a898f79 /example.py
parentc59213e2e9dd7efc41ca23d96ab18032f614dc32 (diff)
downloadcliapp-ad74f25c8b75b265f7e5b11f43414f846cafc369.tar.gz
Update example to use string lists instead of plain strings.
Diffstat (limited to 'example.py')
-rw-r--r--example.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/example.py b/example.py
index b54fca6..dd0fac1 100644
--- a/example.py
+++ b/example.py
@@ -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()