Encapsulate the ui, completer, command history, docs, and config. Runs the input event loop and delegates the command execution to either the `awscli` or the underlying shell. :type refresh_cli: bool :param refresh_cli: Flag to refresh the cli. :type config_obj: :class:`config
| 189 | |
| 190 | |
| 191 | class AWSShell(object): |
| 192 | """Encapsulate the ui, completer, command history, docs, and config. |
| 193 | |
| 194 | Runs the input event loop and delegates the command execution to either |
| 195 | the `awscli` or the underlying shell. |
| 196 | |
| 197 | :type refresh_cli: bool |
| 198 | :param refresh_cli: Flag to refresh the cli. |
| 199 | |
| 200 | :type config_obj: :class:`configobj.ConfigObj` |
| 201 | :param config_obj: Contains the config information for reading and writing. |
| 202 | |
| 203 | :type config_section: :class:`configobj.Section` |
| 204 | :param config_section: Convenience attribute to access the main section |
| 205 | of the config. |
| 206 | |
| 207 | :type model_completer: :class:`AWSCLIModelCompleter` |
| 208 | :param model_completer: Matches input with completions. `AWSShell` sets |
| 209 | and gets the attribute `AWSCLIModelCompleter.match_fuzzy`. |
| 210 | |
| 211 | :type enable_vi_bindings: bool |
| 212 | :param enable_vi_bindings: If True, enables Vi key bindings. Else, Emacs |
| 213 | key bindings are enabled. |
| 214 | |
| 215 | :type show_completion_columns: bool |
| 216 | param show_completion_columns: If True, completions are shown in multiple |
| 217 | columns. Else, completions are shown in a single scrollable column. |
| 218 | |
| 219 | :type show_help: bool |
| 220 | :param show_help: If True, shows the help pane. Else, hides the help pane. |
| 221 | |
| 222 | :type theme: str |
| 223 | :param theme: The pygments theme. |
| 224 | |
| 225 | """ |
| 226 | |
| 227 | def __init__(self, completer, model_completer, docs, |
| 228 | input=None, output=None, popen_cls=None): |
| 229 | self.completer = completer |
| 230 | self.model_completer = model_completer |
| 231 | self.history = InMemoryHistory() |
| 232 | self.file_history = FileHistory(build_config_file_path('history')) |
| 233 | self._cli = None |
| 234 | self._docs = docs |
| 235 | self.current_docs = u'' |
| 236 | self.refresh_cli = False |
| 237 | self.key_manager = None |
| 238 | self._dot_cmd = DotCommandHandler() |
| 239 | self._env = os.environ.copy() |
| 240 | self._profile = None |
| 241 | self._input = input |
| 242 | self._output = output |
| 243 | |
| 244 | if popen_cls is None: |
| 245 | popen_cls = subprocess.Popen |
| 246 | self._popen_cls = popen_cls |
| 247 | |
| 248 | # These attrs come from the config file. |
no outgoing calls