MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / process_command

Method process_command

keepercommander/cli.py:668–705  ·  view source on GitHub ↗

Process debug command.

(self, tokens, batch_mode)

Source from the content-addressed store, hash-verified

666 return new_state
667
668 def process_command(self, tokens, batch_mode):
669 """Process debug command."""
670 # Look for --file argument
671 file_path = None
672 file_flag_present = False
673
674 for i, token in enumerate(tokens[1:], 1):
675 if token == '--file':
676 file_flag_present = True
677 if i + 1 < len(tokens):
678 next_token = tokens[i + 1]
679 if not next_token.startswith('-'):
680 file_path = next_token
681 break
682 elif token.startswith('--file='):
683 file_flag_present = True
684 file_path = token.split('=', 1)[1]
685 # Handle empty value after equals sign
686 if not file_path.strip():
687 file_path = None
688 break
689
690 if file_flag_present and not file_path:
691 print("Please specify the file path for logging to file: debug --file <file_path>")
692 return False
693 elif file_path:
694 return self.setup_file_logging(file_path)
695 else:
696 # No --file flag present, check for potential filename arguments
697 if len(tokens) > 1:
698 for token in tokens[1:]:
699 # Check if token looks like a filename
700 if not token.startswith('-') and self._looks_like_filename(token):
701 print(f"Please specify the --file flag for logging to file: debug --file {token}")
702 return False
703
704 self.toggle_console_debug(batch_mode)
705 return True
706
707debug_manager = DebugManager()
708

Callers 1

do_commandFunction · 0.80

Calls 3

setup_file_loggingMethod · 0.95
_looks_like_filenameMethod · 0.95
toggle_console_debugMethod · 0.95

Tested by

no test coverage detected