Process debug command.
(self, tokens, batch_mode)
| 763 | return new_state |
| 764 | |
| 765 | def process_command(self, tokens, batch_mode): |
| 766 | """Process debug command.""" |
| 767 | # Look for --file argument |
| 768 | file_path = None |
| 769 | file_flag_present = False |
| 770 | |
| 771 | for i, token in enumerate(tokens[1:], 1): |
| 772 | if token == '--file': |
| 773 | file_flag_present = True |
| 774 | if i + 1 < len(tokens): |
| 775 | next_token = tokens[i + 1] |
| 776 | if not next_token.startswith('-'): |
| 777 | file_path = next_token |
| 778 | break |
| 779 | elif token.startswith('--file='): |
| 780 | file_flag_present = True |
| 781 | file_path = token.split('=', 1)[1] |
| 782 | # Handle empty value after equals sign |
| 783 | if not file_path.strip(): |
| 784 | file_path = None |
| 785 | break |
| 786 | |
| 787 | if file_flag_present and not file_path: |
| 788 | print("Please specify the file path for logging to file: debug --file <file_path>") |
| 789 | return False |
| 790 | elif file_path: |
| 791 | return self.setup_file_logging(file_path) |
| 792 | else: |
| 793 | # No --file flag present, check for potential filename arguments |
| 794 | if len(tokens) > 1: |
| 795 | for token in tokens[1:]: |
| 796 | # Check if token looks like a filename |
| 797 | if not token.startswith('-') and self._looks_like_filename(token): |
| 798 | print(f"Please specify the --file flag for logging to file: debug --file {token}") |
| 799 | return False |
| 800 | |
| 801 | self.toggle_console_debug(batch_mode) |
| 802 | return True |
| 803 | |
| 804 | debug_manager = DebugManager() |
| 805 |
no test coverage detected