How to use the cmd2.Cmd.__init__ function in cmd2

To help you get started, we’ve selected a few cmd2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python-cmd2 / cmd2 / tests / test_argparse.py View on Github external
def __init__(self):
        self.maxrepeats = 3
        cmd2.Cmd.__init__(self)
github raff / dynash / dynash2 / dynash2.py View on Github external
def __init__(self, verbose=False):
        Cmd.__init__(self)

        self.pp = pprint.PrettyPrinter(indent=4)

        self.connect()

        # by default readline thinks - and other characters are word delimiters :(
        if readline:
            readline.set_completer_delims(re.sub('[-~]', '', readline.get_completer_delims()))

            path = os.path.join(os.environ.get('HOME', ''), HISTORY_FILE)
            self.history_file = os.path.abspath(path)
        else:
            self.history_file = None

        self.tables = []
        self.table = None
github roglew / pappy-proxy / pappyproxy / console.py View on Github external
self.client = kwargs['client']
        self.client.console = self
        del kwargs['client']

        self._cmds = {}
        self._aliases = {}

        atexit.register(self.save_histfile)
        readline.set_history_length(self.histsize)
        if os.path.exists('cmdhistory'):
            if self.histsize != 0:
                readline.read_history_file('cmdhistory')
            else:
                os.remove('cmdhistory')

        cmd2.Cmd.__init__(self, *args, **kwargs)
github kushaldas / darkserver / darkimporter / dashboard.py View on Github external
def __init__(self):
        Cmd.__init__(self)
        logging.basicConfig(filename='/tmp/darkdashboard.log', level=logging.INFO,\
                        format='%(asctime)s:%(name)s:%(levelname)s:%(message)s')
        self.logger = logging.getLogger("darkdashboard")
        self.prompt = 'dark> '
        self.rdb = redis_connection()
        print(self.bold(self.colorize('Welcome to DarkServer Dashboard', 'blue')))
github fernnf / vsdnemul / Command / command.py View on Github external
def __init__(self, dataplane: Data):

        self.prompt = "[cli@vsdnagent]# "
        self.links = links
        self.nodes = nodes

        Cmd.__init__(self, use_ipython = False)
github jookies / jasmin / cli / base.py View on Github external
def __init__(self, router = None, smppcm = None, *args, **kwargs):
        Cmd.__init__(self, *args, **kwargs)
        
        # Init connections to router and smppcm
        self.router = router
        self.smppcm = smppcm
        
        # Remove settable parameters
        Cmd.settable = StubbornDict()
github opencord / voltha / cli / omci.py View on Github external
def __init__(self, device_id, get_stub):
        Cmd.__init__(self)
        self.get_stub = get_stub
        self.device_id = device_id
        self.prompt = '(' + self.colorize(
            self.colorize('omci {}'.format(device_id), 'green'),
            'bold') + ') '
github dsnezhkov / octohook / cmdservice.py View on Github external
def __init__(self):
      cmd2.Cmd.__init__(self)
      self.prompt="->> "