MCPcopy Index your code
hub / github.com/awslabs/aws-shell / run

Method run

awsshell/app.py:289–320  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

287 return self._cli
288
289 def run(self):
290 while True:
291 try:
292 document = self.cli.run(reset_current_buffer=True)
293 text = document.text
294 except InputInterrupt:
295 pass
296 except (KeyboardInterrupt, EOFError):
297 self.save_config()
298 break
299 else:
300 if text.startswith('.'):
301 # These are special commands (dot commands) that are
302 # interpreted by the aws-shell directly and typically used
303 # to modify some type of behavior in the aws-shell.
304 result = self._dot_cmd.handle_cmd(text, application=self)
305 if result is EXIT_REQUESTED:
306 break
307 else:
308 if text.startswith('!'):
309 # Then run the rest as a normally shell command.
310 full_cmd = text[1:]
311 else:
312 full_cmd = 'aws ' + text
313 self.history.append(full_cmd)
314 self.current_docs = u''
315 self.cli.buffers['clidocs'].reset(
316 initial_document=Document(self.current_docs,
317 cursor_position=0))
318 self.cli.request_redraw()
319 p = self._popen_cls(full_cmd, shell=True, env=self._env)
320 p.communicate()
321
322 def stop_input_and_refresh_cli(self):
323 """Stop input by raising an `InputInterrupt`, forces a cli refresh.

Callers 4

mainFunction · 0.45
handle_cmdMethod · 0.45

Calls 3

save_configMethod · 0.95
handle_cmdMethod · 0.80
resetMethod · 0.80

Tested by 2