How do I subclass pyCLI's cli.app.CommandLineApp?
<p><a href="http://packages.python.org/pyCLI/" rel="nofollow">The documentation</a> is really vague about subclassing the CommandLineApp, only mentioning one example:</p>

<pre><code>class YourApp(cli.app.CommandLineApp):
    def main(self):
        do_stuff()
</code></pre>

<p>So with the information I've found I've pieced together this code:</p>

<pre><code>#!/usr/bin/env python

import os
import sys
from cli.app import CommandLineApp

# Append the parent folder to the python path
sys.path.append(os.path.join(os.path.dirname(__file__), '../'))

import tabulardata
from addrtools import extract_address

class SplitAddressApp(CommandLineApp):
    def main(self):
        """
        Split an address from one column to separate columns.
        """

        table = tabulardata.from_file(self.params.file)

        def for_each_row(i, item):
            addr = extract_address(item['Address'])
            print '%-3d %-75s %s' % (i, item['Address'], repr(addr))

        table.each(for_each_row)

    def setup(self):
        self.add_param('file', metavar='FILE', help='The data file.')
        self.add_param(
            'cols', metavar='ADDRESS_COLUMN', nargs='+',
            help='The name of the address column. If multiple names are ' + \
                 'passed, each column will be checked for an address in order'
        )

if __name__ == '__main__':
    SplitAddressApp().run()
</code></pre>

<p>Which seems correct to me. The documentation gives no examples on how to handle the <code>setup</code> method or running the application when using subclassing. I get the error:</p>

<pre>
Traceback (most recent call last):
  File "bin/split_address_column", line 36, in 
    SplitAddressApp().run()
  File "/Users/tomas/.pythonbrew/venvs/Python-2.7.3/address_cleaner/lib/python2.7/site-packages/cli/app.py", line 440, in __init__
    Application.__init__(self, main, **kwargs)
  File "/Users/tomas/.pythonbrew/venvs/Python-2.7.3/address_cleaner/lib/python2.7/site-packages/cli/app.py", line 129, in __init__
    self.setup()
  File "bin/split_address_column", line 28, in setup
    self.add_param('file', metavar='FILE', help='The data file.')
  File "/Users/tomas/.pythonbrew/venvs/Python-2.7.3/address_cleaner/lib/python2.7/site-packages/cli/app.py", line 385, in add_param
    action = self.argparser.add_argument(*args, **kwargs)
AttributeError: 'SplitAddressApp' object has no attribute 'argparser'
</pre>

<p>So presumably I'm doing something wrong, but what?</p>
