package cli import ( "fmt" "os" "os/exec" "runtime" "strings" ) // HandleServiceCommand handles systemd service management commands func HandleServiceCommand(args []string) { if len(args) == 0 { showServiceHelp() return } if runtime.GOOS != "linux" { fmt.Fprintf(os.Stderr, "❌ Service commands are only supported on Linux with systemd\n") os.Exit(1) } subcommand := args[0] subargs := args[1:] switch subcommand { case "start": handleServiceStart(subargs) case "stop": handleServiceStop(subargs) case "restart": handleServiceRestart(subargs) case "status": handleServiceStatus(subargs) case "logs": handleServiceLogs(subargs) case "help": showServiceHelp() default: fmt.Fprintf(os.Stderr, "Unknown service subcommand: %s\n", subcommand) showServiceHelp() os.Exit(1) } } func showServiceHelp() { fmt.Printf("🔧 Service Management Commands\n\n") fmt.Printf("Usage: network-cli service [options]\n\n") fmt.Printf("Subcommands:\n") fmt.Printf(" start - Start services\n") fmt.Printf(" stop - Stop services\n") fmt.Printf(" restart - Restart services\n") fmt.Printf(" status - Show service status\n") fmt.Printf(" logs - View service logs\n\n") fmt.Printf("Targets:\n") fmt.Printf(" node - DeBros node service\n") fmt.Printf(" gateway - DeBros gateway service\n") fmt.Printf(" all - All DeBros services\n\n") fmt.Printf("Logs Options:\n") fmt.Printf(" --follow - Follow logs in real-time (-f)\n") fmt.Printf(" --since=