Ivan Dagelic d3fcd80f10 fix(cli): windows ssh call
Signed-off-by: Ivan Dagelic <dagelic.ivan@gmail.com>
2026-01-28 13:38:16 +01:00

26 lines
529 B
Go

// Copyright Daytona Platforms Inc.
// SPDX-License-Identifier: AGPL-3.0
package common
import (
"fmt"
"strings"
)
// ParseSSHCommand parses the SSH command string returned by the API
// Expected formats:
// - "ssh token@host" (port 22)
// - "ssh -p port token@host"
func ParseSSHCommand(sshCommand string) ([]string, error) {
parts := strings.Fields(sshCommand)
if len(parts) < 2 {
return nil, fmt.Errorf("invalid SSH command format: %s", sshCommand)
}
// Skip the "ssh" part
args := parts[1:]
return args, nil
}