🔍 Code Extractor

function main_v50

Maturity: 40

A command-line interface (CLI) entry point that parses command-line arguments and dispatches to various development tool functions for managing browser cache, static files, and debug endpoints.

File:
/tf/active/vicechatdev/vice_ai/dev_tools.py
Lines:
84 - 102
Complexity:
simple

Purpose

This function serves as the main entry point for a development tools menu system. It processes command-line arguments to execute different development tasks: clearing browser cache ('clear'), checking static files and debug endpoints ('check'), touching/updating static files ('touch'), or displaying debug endpoint information ('info'). If no valid command is provided, it displays help information.

Source Code

def main():
    """Main development tools menu"""
    if len(sys.argv) > 1:
        command = sys.argv[1].lower()
        
        if command == "clear":
            clear_browser_cache_instructions()
        elif command == "check":
            check_static_files()
            check_debug_endpoint()
        elif command == "touch":
            touch_static_files()
        elif command == "info":
            check_debug_endpoint()
        else:
            print(f"❌ Unknown command: {command}")
            print_help()
    else:
        print_help()

Return Value

This function does not return any value (implicitly returns None). It performs side effects by calling other functions based on command-line arguments and printing output to the console.

Dependencies

  • requests

Required Imports

import sys
import os
import time
import requests
from pathlib import Path

Usage Example

# Run from command line:
# python script.py clear
# python script.py check
# python script.py touch
# python script.py info
# python script.py  # Shows help

# Or call directly in code:
if __name__ == '__main__':
    main()

Best Practices

  • This function should be called as the entry point of a script using if __name__ == '__main__': main()
  • Ensure all helper functions (clear_browser_cache_instructions, check_static_files, check_debug_endpoint, touch_static_files, print_help) are defined before calling main()
  • Command-line arguments are case-insensitive due to .lower() conversion
  • The function expects sys.argv[1] to contain the command, so it should be run with at least one argument or will display help
  • Error handling for unknown commands is built-in and will display help information

Similar Components

AI-powered semantic similarity - components with related functionality:

  • function main_v41 61.1% similar

    Entry point function that parses command-line arguments and orchestrates the FileCloud email processing workflow to find, download, and convert .msg files.

    From: /tf/active/vicechatdev/msg_to_eml.py
  • function print_help 60.5% similar

    Displays help information for Vice AI Development Tools, listing available commands and usage examples.

    From: /tf/active/vicechatdev/vice_ai/dev_tools.py
  • function main_v4 60.5% similar

    Main entry point function for the Contract Validity Analyzer application that orchestrates configuration loading, logging setup, FileCloud connection, and contract analysis execution.

    From: /tf/active/vicechatdev/contract_validity_analyzer/main.py
  • function main_v19 59.9% similar

    Entry point function that initializes and serves the CDocs Panel web application with configurable port and debug mode options.

    From: /tf/active/vicechatdev/cdocs_panel_app.py
  • function main_v32 58.0% similar

    Command-line interface entry point for monitoring SharePoint to FileCloud synchronization logs, providing status analysis, log tailing, and real-time watching capabilities.

    From: /tf/active/vicechatdev/SPFCsync/monitor.py
← Back to Browse