@@ -61,9 +61,19 @@ def _get_editor_command(self):
61
61
else :
62
62
return compat .default_editor ()
63
63
64
- def run (self , command , context ):
64
+ def run (self , command , application ):
65
+ """Open application's history buffer in an editor.
66
+
67
+ :type command: list
68
+ :param command: The dot command as a list split
69
+ on whitespace, e.g ``['.foo', 'arg1', 'arg2']``
70
+
71
+ :type application: AWSShell
72
+ :param application: The application object.
73
+
74
+ """
65
75
all_commands = '\n ' .join (
66
- ['aws ' + h for h in list (context .history )
76
+ ['aws ' + h for h in list (application .history )
67
77
if not h .startswith (('.' , '!' ))])
68
78
with tempfile .NamedTemporaryFile ('w' ) as f :
69
79
f .write (all_commands )
@@ -82,27 +92,27 @@ def __init__(self, output=sys.stdout, err=sys.stderr):
82
92
self ._output = output
83
93
self ._err = err
84
94
85
- def handle_cmd (self , command , context ):
95
+ def handle_cmd (self , command , application ):
86
96
"""Handles running a given dot command from a user.
87
97
88
98
:type command: str
89
99
:param command: The full dot command string, e.g. ``.edit``,
90
100
of ``.profile prod``.
91
101
92
- :type context : AWSShell
93
- :param context : The application object.
102
+ :type application : AWSShell
103
+ :param application : The application object.
94
104
95
105
"""
96
106
parts = command .split ()
97
107
cmd_name = parts [0 ][1 :]
98
108
if cmd_name not in self .HANDLER_CLASSES :
99
- self ._unknown_cmd (parts , context )
109
+ self ._unknown_cmd (parts , application )
100
110
else :
101
111
# Note we expect the class to support no-arg
102
112
# instantiation.
103
- self .HANDLER_CLASSES [cmd_name ]().run (parts , context )
113
+ self .HANDLER_CLASSES [cmd_name ]().run (parts , application )
104
114
105
- def _unknown_cmd (self , cmd_parts , context ):
115
+ def _unknown_cmd (self , cmd_parts , application ):
106
116
self ._err .write ("Unknown dot command: %s\n " % cmd_parts [0 ])
107
117
108
118
@@ -200,7 +210,7 @@ def run(self):
200
210
if text .startswith ('.' ):
201
211
# These are special commands. The only one supported for
202
212
# now is .edit.
203
- self ._dot_cmd .handle_cmd (text , context = self )
213
+ self ._dot_cmd .handle_cmd (text , application = self )
204
214
else :
205
215
if text .startswith ('!' ):
206
216
# Then run the rest as a normally shell command.
0 commit comments