2025-05-07 20:02:10 +05:30

62 lines
1.6 KiB
Python
Executable File

#!/usr/bin/env python3
"""
SSHFileToCbs - File Transfer Application
This application transfers files between local and remote servers using SSH/SFTP or FTP.
It's a modernized Python replacement for the legacy Java application.
"""
import argparse
import logging
import os
import sys
from pathlib import Path
from src.app import Application
def parse_arguments():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(description="SSH/FTP File Transfer Application")
parser.add_argument(
"--config",
type=str,
help="Path to configuration file (default: config/config.ini)"
)
parser.add_argument(
"--log-level",
type=str,
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
default="INFO",
help="Set logging level (default: INFO)"
)
return parser.parse_args()
def main():
"""Application entry point"""
# Parse command line arguments
args = parse_arguments()
# Determine log level
log_level = getattr(logging, args.log_level)
# Set up base logger
logging.basicConfig(
level=log_level,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S"
)
logger = logging.getLogger("SSHFileToCbs")
logger.info("Starting SSHFileToCbs application")
# Initialize and run application
app = Application(args.config)
app.run()
logger.info("SSHFileToCbs application finished")
if __name__ == "__main__":
main()