File: example.py

package info (click to toggle)
cmd2 2.4.2%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,672 kB
  • sloc: python: 19,288; makefile: 88; sh: 16
file content (23 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# coding=utf-8

import cmd2_myplugin

import cmd2


class Example(cmd2_myplugin.MyPlugin, cmd2.Cmd):
    """An class to show how to use a plugin"""

    def __init__(self, *args, **kwargs):
        # gotta have this or neither the plugin or cmd2 will initialize
        super().__init__(*args, **kwargs)

    @cmd2_myplugin.empty_decorator
    def do_something(self, arg):
        self.poutput('this is the something command')


if __name__ == '__main__':
    app = Example()
    app.cmdloop()