neithere / argh

An argparse wrapper that doesn't make you say "argh" each time you deal with it.
http://argh.rtfd.org
GNU Lesser General Public License v3.0
369 stars 56 forks source link

Class methods as commands #34

Closed neithere closed 11 years ago

neithere commented 11 years ago

Use case:

class Controller:
    db = {1: 'foo', 2: 'bar'}

    def index(self):
        return self.db.keys()

    def detail(self, key):
        return self.db[key]

c = Controller()
parser.add_commands([c.index, c.detail])

Argh should omit argument self while introspecting methods.

Static methods should work, too.

Note: This issue has been automatically migrated from Bitbucket Created by @neithere on 2013-01-09 20:55:13+00:00, last updated: 2013-01-10 03:29:44+00:00

neithere commented 11 years ago

Fix issue #34: class members (instance/class/static methods) as commands

→ <>

Note: This comment has been automatically migrated from Bitbucket Created by @neithere on 2013-01-10 03:29:44+00:00