ParseArguments

Function ParseArguments 

Source
pub(crate) fn ParseArguments() -> (Option<String>, Option<String>, Option<Command>)
Expand description

Parse command line arguments into daemon config or CLI command

Handles two modes of operation:

  1. CLI mode: Execute commands like status, restart, config, etc.
  2. Daemon mode: Start the background service with optional config/bind args

§Arguments

Returns a tuple of (config_path, bind_address, optional_command)

  • If command is Some, daemon startup should be skipped
  • Otherwise, start daemon with provided config path and bind address

§TODO

  • Add validation for bind address format
  • Add validation for config file exists/readable
  • Support --validate-config flag to check config without starting
  • Add --daemon flag to force daemon mode with CLI commands
  • Make flags case-insensitive
  • Add –no-daemon flag for foreground operation