function print_usage
Displays formatted usage instructions for the reMarkable PDF Upload Tool command-line interface, showing syntax, arguments, and examples.
/tf/active/vicechatdev/e-ink-llm/cloudtest/upload_pdf_new.py
109 - 125
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
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
function main_v22 70.1% similar
-
function main_v26 62.1% similar
-
function print_help 59.3% similar
-
function main_v82 57.6% similar
-
function generate_header_examples 53.6% similar