Module e2eeftp.cli
Command-line interface for E2EEFTP.
This module provides the main entry point for running E2EEFTP in either server or client mode. It handles command-line argument parsing and delegates to the appropriate components.
Functions
def cli()-
Expand source code
def cli(): """ Main CLI entry point that parses command-line arguments and starts either server or client mode. This function sets up an argument parser with subcommands for server and client modes, parses the command-line arguments, and invokes the appropriate function based on the selected mode. It serves as the primary interface for users to interact with E2EEFTP from the command line. The function supports the following modes: - server: Starts an E2EEFTP server - client: Starts an E2EEFTP client CLI Both modes accept --host and --port arguments with sensible defaults. """ parser = argparse.ArgumentParser(description="E2EEFTP - End-to-End Encrypted FTP") subparsers = parser.add_subparsers(dest="mode", help="Mode of operation") # Server mode server_parser = subparsers.add_parser("server", help="Run in server mode") server_parser.add_argument("--host", type=str, default="127.0.0.1", help="Host to bind the server (default: localhost)") server_parser.add_argument("--port", type=int, default=2121, help="Port to bind the server (default: 2121)") # Client mode client_parser = subparsers.add_parser("client", help="Run in client mode") client_parser.add_argument("--host", type=str, default="127.0.0.1", help="Host to connect to (default: localhost)") client_parser.add_argument("--port", type=int, default=2121, help="Port to connect to (default: 2121)") args = parser.parse_args() if args.mode == "server": server(args.host, args.port) elif args.mode == "client": client_cli(args.host, args.port)Main CLI entry point that parses command-line arguments and starts either server or client mode.
This function sets up an argument parser with subcommands for server and client modes, parses the command-line arguments, and invokes the appropriate function based on the selected mode. It serves as the primary interface for users to interact with E2EEFTP from the command line.
The function supports the following modes: - server: Starts an E2EEFTP server - client: Starts an E2EEFTP client CLI
Both modes accept –host and –port arguments with sensible defaults.