🔍 Code Extractor

function print_usage

Maturity: 40

Displays formatted usage instructions for the reMarkable PDF Upload Tool command-line interface, showing syntax, arguments, and examples.

File:
/tf/active/vicechatdev/e-ink-llm/cloudtest/upload_pdf_new.py
Lines:
109 - 125
Complexity:
simple

Purpose

This function serves as a help/documentation display for users of the reMarkable PDF Upload Tool. It prints comprehensive usage instructions including command syntax, argument descriptions, and practical examples to guide users on how to properly invoke the upload_pdf.py script with correct parameters. It's typically called when the script is run without arguments or with incorrect arguments to help users understand the expected input format.

Source Code

def print_usage():
    """Print usage instructions"""
    print("📚 reMarkable PDF Upload Tool")
    print()
    print("Usage:")
    print("  python upload_pdf.py <pdf_file> <document_name> [parent_uuid]")
    print()
    print("Arguments:")
    print("  pdf_file      - Path to the PDF file to upload")
    print("  document_name - Name for the document on reMarkable")
    print("  parent_uuid   - (Optional) UUID of parent folder")
    print()
    print("Examples:")
    print("  python upload_pdf.py ~/document.pdf 'My Document'")
    print("  python upload_pdf.py ~/report.pdf 'Weekly Report' folder-uuid-here")
    print()
    print("💡 Run without arguments to see available folders")

Return Value

This function returns None (implicitly). It performs a side effect of printing formatted text to standard output (stdout) containing usage instructions, argument descriptions, and usage examples.

Usage Example

# Simply call the function to display usage instructions
print_usage()

# Typical usage in a CLI script:
import sys

if len(sys.argv) < 3:
    print_usage()
    sys.exit(1)

Best Practices

  • This function should be called when users provide insufficient or incorrect command-line arguments
  • Call this function before sys.exit(1) to ensure users see the help message before the program terminates
  • The function uses emoji characters (📚, 💡) which may not display correctly in all terminal environments
  • Consider calling this function when a --help or -h flag is provided
  • This is a pure display function with no side effects other than printing to stdout, making it safe to call at any time

Similar Components

AI-powered semantic similarity - components with related functionality:

  • function main_v22 70.1% similar

    Command-line entry point for a reMarkable PDF upload tool that handles argument parsing, folder listing, and PDF document uploads to a reMarkable device.

    From: /tf/active/vicechatdev/e-ink-llm/cloudtest/upload_pdf_new.py
  • function main_v26 62.1% similar

    Command-line test function that uploads a PDF document to a reMarkable device, with optional parent folder specification via command-line argument.

    From: /tf/active/vicechatdev/e-ink-llm/cloudtest/final_uploads.py
  • function print_help 59.3% 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_v82 57.6% similar

    Entry point function that initializes and runs a PDF upload test for reMarkable devices, with comprehensive error handling and traceback reporting.

    From: /tf/active/vicechatdev/e-ink-llm/cloudtest/test_simple_pdf_upload.py
  • function generate_header_examples 53.6% similar

    Prints formatted examples of HTTP headers required for different types of file uploads to a reMarkable cloud sync service, including PDFs, metadata, content, and schema files.

    From: /tf/active/vicechatdev/e-ink-llm/cloudtest/analyze_headers.py
← Back to Browse