Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiline command #200

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions awsshell/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from prompt_toolkit.document import Document
from prompt_toolkit.shortcuts import create_eventloop
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.filters import Always
from prompt_toolkit.filters import Always, Condition
from prompt_toolkit.interface import CommandLineInterface, Application
from prompt_toolkit.interface import AbortAction, AcceptAction
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
Expand Down Expand Up @@ -344,14 +344,20 @@ def create_layout(self, display_completions_in_columns, toolbar):
get_bottom_toolbar_tokens=toolbar.handler)

def create_buffer(self, completer, history):
return Buffer(
def is_buffer_multiline():
return buffer.document.text.endswith('\\')

buffer = Buffer(
history=history,
auto_suggest=AutoSuggestFromHistory(),
enable_history_search=True,
completer=completer,
complete_while_typing=Always(),
is_multiline=Condition(is_buffer_multiline),
accept_action=AcceptAction.RETURN_DOCUMENT)

return buffer

def create_key_manager(self):
"""Create the :class:`KeyManager`.

Expand Down