summaryrefslogtreecommitdiff
path: root/demoapp/cliffdemo/simple.py
blob: 5e8e98ef3a12e89bb8c7fdb49fb4857ecae21ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import logging

from cliff.command import Command


class Simple(Command):
    "A simple command that prints a message."

    log = logging.getLogger(__name__)

    def run(self, parsed_args):
        self.log.info('sending greeting')
        self.log.debug('debugging')
        self.app.stdout.write('hi!\n')


class Error(Command):
    "Always raises an error"

    log = logging.getLogger(__name__)

    def run(self, parsed_args):
        self.log.info('causing error')
        raise RuntimeError('this is the expected exception')