MCPcopy Index your code
hub / github.com/RUB-NDS/PRET / precmd

Method precmd

printer.py:105–132  ·  view source on GitHub ↗
(self, line)

Source from the content-addressed store, hash-verified

103 # --------------------------------------------------------------------
104 # code to be executed before command line is interpreted
105 def precmd(self, line):
106 # commands that can be run offline
107 off_cmd = [
108 "#",
109 "?",
110 "help",
111 "exit",
112 "quit",
113 "EOF",
114 "timeout",
115 "mode",
116 "load",
117 "loop",
118 "discover",
119 "open",
120 "debug",
121 ]
122 # remove whitepaces
123 line = line.strip()
124 if line and line.split()[0] not in off_cmd:
125 # write non-empty lines to logfile
126 log().comment(self.logfile, line)
127 # only let "offline" functions pass if not connected
128 if self.conn == None:
129 print((self.offline_str))
130 return os.linesep
131 # finally return original command
132 return line
133
134 # --------------------------------------------------------------------
135 # catch-all wrapper to guarantee continuation on unhandled exceptions

Callers 1

do_loadMethod · 0.95

Calls 2

logClass · 0.90
commentMethod · 0.80

Tested by

no test coverage detected