Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chronologos committed Aug 4, 2016
1 parent 14ceb80 commit 89b1562
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions awsshell/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def __init__(self, completer, model_completer, docs):
self._dot_cmd = DotCommandHandler()
self._env = os.environ.copy()
self._profile = None
self.prompt_tokens = u'aws> '
self.prompt_tokens = u'aws > '

# These attrs come from the config file.
self.config_obj = None
Expand Down Expand Up @@ -282,34 +282,36 @@ def run(self):
document = self.cli.run(reset_current_buffer=True)
if self.model_completer.context and isinstance(self.model_completer.context, list):
text = " ".join(self.model_completer.context) + " " + document.text
original_text = document.text
else:
text = document.text
original_text = text
except InputInterrupt:
pass
except (KeyboardInterrupt, EOFError):
self.save_config()
break
else:
if text.startswith('.'):
if original_text.startswith('.'):
# These are special commands (dot commands) that are
# interpreted by the aws-shell directly and typically used
# to modify some type of behavior in the aws-shell.
result = self._dot_cmd.handle_cmd(text, application=self)
if result is EXIT_REQUESTED:
break
else:
if text.startswith('!'):
if original_text.startswith('!'):
# Then run the rest as a normally shell command.
full_cmd = text[1:]
elif text.startswith('@') and len(text.split()) == 1:
elif original_text.startswith('@'):
# Add word as context to completions
self.model_completer.context.append(text.split()[0].strip('@'))
self.model_completer.reset()
self.prompt_tokens = u'aws ' + ' '.join(self.model_completer.context) + u' > '
self.refresh_cli = True
self.cli.request_redraw()
continue
elif 'exit' in text.split():
elif original_text == 'exit':
# Remove most recently added context
if self.model_completer.context:
self.model_completer.context.pop()
Expand Down

0 comments on commit 89b1562

Please sign in to comment.