Process debug command.
(self, tokens, batch_mode)
| 791 | return new_state |
| 792 | |
| 793 | def process_command(self, tokens, batch_mode): |
| 794 | """Process debug command.""" |
| 795 | # Look for --file argument |
| 796 | file_path = None |
| 797 | file_flag_present = False |
| 798 | |
| 799 | for i, token in enumerate(tokens[1:], 1): |
| 800 | if token == '--file': |
| 801 | file_flag_present = True |
| 802 | if i + 1 < len(tokens): |
| 803 | next_token = tokens[i + 1] |
| 804 | if not next_token.startswith('-'): |
| 805 | file_path = next_token |
| 806 | break |
| 807 | elif token.startswith('--file='): |
| 808 | file_flag_present = True |
| 809 | file_path = token.split('=', 1)[1] |
| 810 | # Handle empty value after equals sign |
| 811 | if not file_path.strip(): |
| 812 | file_path = None |
| 813 | break |
| 814 | |
| 815 | if file_flag_present and not file_path: |
| 816 | print("Please specify the file path for logging to file: debug --file <file_path>") |
| 817 | return False |
| 818 | elif file_path: |
| 819 | return self.setup_file_logging(file_path) |
| 820 | else: |
| 821 | # No --file flag present, check for potential filename arguments |
| 822 | if len(tokens) > 1: |
| 823 | for token in tokens[1:]: |
| 824 | # Check if token looks like a filename |
| 825 | if not token.startswith('-') and self._looks_like_filename(token): |
| 826 | print(f"Please specify the --file flag for logging to file: debug --file {token}") |
| 827 | return False |
| 828 | |
| 829 | self.toggle_console_debug(batch_mode) |
| 830 | return True |
| 831 | |
| 832 | debug_manager = DebugManager() |
| 833 |
no test coverage detected