def cmdloop(self, opts):
""" Interactive mode worker function
:param opts: command options
:type opts: options.
"""
self.interactive = True
if not opts.nologo:
CLI.version(self._progname, versioning.__version__,\
versioning.__extracontent__, fileh=sys.stdout)
if opts.debug:
LOGGER.setLevel(logging.DEBUG)
LERR.setLevel(logging.DEBUG)
#**********Handler for GUI tab tab ***************
for section in self._commands:
if section.startswith('_'):
continue
for command in self._commands[section]:
self.commlist.append(command.name)
for item in self.commlist:
if item == "help":
self.candidates[item] = self.commlist
else:
self.candidates[item] = []
self._redobj = TabAndHistoryCompletionClass(dict(self.candidates))
readline.set_completer(self._redobj.main_completer_handler)
readline.parse_and_bind("tab: complete")
#***************************************************
while True:
line = input(versioning.__shortname__+' > ')
readline.add_history(line)
if not len(line):
continue
elif line.endswith(os.linesep):
line.rstrip(os.linesep)
nargv = shlex.split(line, posix=False)
try:
if "login " in line or line == 'login':
self.app.logout()
self.retcode = self._run_command(opts, nargv)
self.check_for_tab_lists(nargv)
except Exception as excp:
self.handle_exceptions(excp)
if self.opts.verbose:
sys.stdout.write(u"REDFISH return code: %s\n" % self.retcode)
return self.retcode
评论列表
文章目录