MCPcopy Create free account
hub / github.com/aws/aws-cli / LiveTailKeyBindings

Class LiveTailKeyBindings

awscli/customizations/logs/ui.py:178–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176
177
178class LiveTailKeyBindings(KeyBindings):
179 def __init__(
180 self,
181 ui,
182 prompt_buffer: Buffer,
183 output_buffer: Buffer,
184 keywords_to_highlight: dict,
185 ) -> None:
186 super().__init__()
187 self._ui = ui
188 self._input_buffer = prompt_buffer
189 self._input_state = InputState.DISABLED
190 self._log_output_buffer = output_buffer
191 self._available_colors = COLOR_LIST.copy()
192 self._keywords_to_highlight = keywords_to_highlight
193 self._is_exit_set = False
194 self._attach_keybindings()
195
196 @property
197 def input_state(self):
198 return self._input_state
199
200 def _attach_keybindings(self):
201 @Condition
202 def is_input_disabled():
203 return self._input_state == InputState.DISABLED
204
205 @Condition
206 def is_input_highlight():
207 return self._input_state == InputState.HIGHLIGHT
208
209 @Condition
210 def is_input_clear():
211 return self._input_state == InputState.CLEAR
212
213 @Condition
214 def is_prompt_active():
215 return (
216 get_app().layout.current_control
217 == self._ui.prompt_buffer_control
218 )
219
220 @Condition
221 def is_cursor_at_bottom():
222 return self._log_output_buffer.cursor_position == len(
223 self._log_output_buffer.text
224 )
225
226 @Condition
227 def is_keyword_addition_allowed():
228 return len(self._keywords_to_highlight) < MAX_KEYWORDS_ALLOWED
229
230 @Condition
231 def is_clear_keyword_allowed():
232 return len(self._keywords_to_highlight) > 0
233
234 @Condition
235 def is_exit_set():

Callers 2

setUpMethod · 0.90
_create_uiMethod · 0.85

Calls

no outgoing calls

Tested by 1

setUpMethod · 0.72